Files
ziti/tests/sdk_api_session_token_update_test.go
Paul Lorenz 86092a8640 Migrate to the sdk-golang v2 module path. For #3884
Bumps the sdk-golang dependency from v1 to the v2 module
(`github.com/openziti/sdk-golang/v2` at v2.0.0-pre1) and updates all
import paths. This is a no-behavior-change precursor that isolates the
dependency migration from the Connect-V2 feature work in #3884.

- Rewrites `github.com/openziti/sdk-golang/...` imports to
  `github.com/openziti/sdk-golang/v2/...` across the main and zititest
  modules.
- Pins both modules to `github.com/openziti/sdk-golang/v2 v2.0.0-pre1`.
- Adapts `edgeXgressConn.AcceptMessage` to the v2 `MsgSink` signature,
  which now takes an `edge.SdkChannel` argument.
- Replaces the removed `edge.Conn.GetRouterId()` with
  `RemoteAddr().String()` in the loop4 traffic-test logging.

For openziti/sdk-golang#936.
2026-06-23 15:43:39 -04:00

38 lines
1013 B
Go

package tests
import (
"testing"
"github.com/openziti/sdk-golang/v2/ziti"
"github.com/openziti/ziti/v2/common/eid"
)
func Test_SDK_API_Session_Token_Update(t *testing.T) {
ctx := NewTestContext(t)
defer ctx.Teardown()
ctx.StartServer()
ctx.RequireAdminManagementApiLogin()
ctx.CreateEnrollAndStartEdgeRouter()
ctx.AdminManagementSession.requireNewEdgeRouterPolicy(s("#all"), s("#all"))
ctx.AdminManagementSession.requireNewServiceEdgeRouterPolicy(s("#all"), s("#all"))
sdkRole := eid.New()
_, hostContextIface := ctx.AdminManagementSession.RequireCreateSdkContext(sdkRole)
defer hostContextIface.Close()
sdkContext, ok := hostContextIface.(*ziti.ContextImpl)
ctx.Req.True(ok, "sdkContext should be of type *ziti.ContextImpl")
ctx.Req.NotNil(sdkContext)
err := sdkContext.Authenticate()
ctx.Req.NoError(err)
err = sdkContext.ConnectAllAvailableErs()
ctx.Req.NoError(err)
functionalErr, erErr := sdkContext.RefreshApiSession()
ctx.Req.NoError(functionalErr)
ctx.Req.NoError(erErr)
}