Skip to content

Commit

Permalink
Rework TestConnect_CancelDuringRequest to new sandbox
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
  • Loading branch information
Vladimir Popov committed Apr 30, 2021
1 parent 11b8cb4 commit f38fd7c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/networkservice/common/connect/server_cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ func TestConnect_CancelDuringRequest(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

domain := sandbox.NewBuilder(t).
domain := sandbox.NewBuilder(ctx, t).
SetNodesCount(1).
SetRegistryProxySupplier(nil).
SetContext(ctx).
Build()

service1Name := "my-service-endpoint"
Expand All @@ -74,12 +73,11 @@ func TestConnect_CancelDuringRequest(t *testing.T) {
}
nscCtx, nscCancel := context.WithCancel(ctx)
var flag atomic.Bool
_, err = domain.Nodes[0].NewEndpoint(ctx, nseReg1, sandbox.GenerateTestToken, checkrequest.NewServer(t, func(*testing.T, *networkservice.NetworkServiceRequest) {
domain.Nodes[0].NewEndpoint(ctx, nseReg1, sandbox.GenerateTestToken, checkrequest.NewServer(t, func(*testing.T, *networkservice.NetworkServiceRequest) {
if flag.Load() {
nscCancel()
}
}))
require.NoError(t, err)

var counter atomic.Int32
ptClient := newPassTroughClient(service1Name)
Expand All @@ -98,7 +96,7 @@ func TestConnect_CancelDuringRequest(t *testing.T) {
Name: "endpoint-2",
NetworkServiceNames: []string{service2Name},
}
_, err = domain.Nodes[0].NewEndpoint(ctx, nseReg2, sandbox.GenerateTestToken,
domain.Nodes[0].NewEndpoint(ctx, nseReg2, sandbox.GenerateTestToken,
chain.NewNetworkServiceServer(
clienturl.NewServer(domain.Nodes[0].NSMgr.URL),
connect.NewServer(ctx,
Expand All @@ -108,7 +106,6 @@ func TestConnect_CancelDuringRequest(t *testing.T) {
),
),
)
require.NoError(t, err)

request := &networkservice.NetworkServiceRequest{
MechanismPreferences: []*networkservice.Mechanism{
Expand Down

0 comments on commit f38fd7c

Please sign in to comment.