From 142de724f82706fed34c3f79d665f4f6ab4ed4cd Mon Sep 17 00:00:00 2001 From: Vladimir Popov Date: Wed, 11 Aug 2021 16:15:24 +0700 Subject: [PATCH] Fix heal tests Signed-off-by: Vladimir Popov --- pkg/networkservice/chains/nsmgr/heal_test.go | 2 +- pkg/networkservice/chains/nsmgr/scale_test.go | 2 +- pkg/networkservice/chains/nsmgr/suite_test.go | 7 ++----- pkg/networkservice/common/heal/heal_test.go | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/networkservice/chains/nsmgr/heal_test.go b/pkg/networkservice/chains/nsmgr/heal_test.go index cb57e86eb5..f132e25d09 100644 --- a/pkg/networkservice/chains/nsmgr/heal_test.go +++ b/pkg/networkservice/chains/nsmgr/heal_test.go @@ -252,7 +252,7 @@ func testNSMGRHealNSMgr(t *testing.T, nodeNum int, restored bool) { } else { domain.Nodes[nodeNum].NSMgr.Cancel() // We need to be sure that Client has noticed NSMgr death - time.Sleep(time.Second) + time.Sleep(3 * time.Second) domain.Nodes[nodeNum].NSMgr.Restart() } diff --git a/pkg/networkservice/chains/nsmgr/scale_test.go b/pkg/networkservice/chains/nsmgr/scale_test.go index b190e2e659..ca19a787f0 100644 --- a/pkg/networkservice/chains/nsmgr/scale_test.go +++ b/pkg/networkservice/chains/nsmgr/scale_test.go @@ -38,7 +38,7 @@ import ( func TestCreateEndpointDuringRequest(t *testing.T) { t.Cleanup(func() { goleak.VerifyNone(t) }) - ctx, cancel := context.WithTimeout(context.Background(), time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() domain := sandbox.NewBuilder(ctx, t). diff --git a/pkg/networkservice/chains/nsmgr/suite_test.go b/pkg/networkservice/chains/nsmgr/suite_test.go index f8b82d1242..7fb2601403 100644 --- a/pkg/networkservice/chains/nsmgr/suite_test.go +++ b/pkg/networkservice/chains/nsmgr/suite_test.go @@ -331,7 +331,7 @@ func (s *nsmgrSuite) Test_ConnectToDeadNSEUsecase() { request := defaultRequest(nsReg.Name) - reqCtx, reqCancel := context.WithTimeout(ctx, time.Second) + reqCtx, reqCancel := context.WithTimeout(ctx, 2*time.Second) defer reqCancel() conn, err := nsc.Request(reqCtx, request.Clone()) @@ -346,10 +346,7 @@ func (s *nsmgrSuite) Test_ConnectToDeadNSEUsecase() { refreshRequest := request.Clone() refreshRequest.Connection = conn.Clone() - refreshReqCtx, refreshReqCancel := context.WithTimeout(ctx, time.Second) - defer refreshReqCancel() - - _, err = nsc.Request(refreshReqCtx, refreshRequest) + _, err = nsc.Request(ctx, refreshRequest) require.Error(t, err) require.NoError(t, reqCtx.Err()) diff --git a/pkg/networkservice/common/heal/heal_test.go b/pkg/networkservice/common/heal/heal_test.go index b307ec768f..98cbec3c78 100644 --- a/pkg/networkservice/common/heal/heal_test.go +++ b/pkg/networkservice/common/heal/heal_test.go @@ -101,5 +101,5 @@ func TestHeal_CloseChain(t *testing.T) { require.Eventually(t, func() bool { return counter.Closes() == 1 - }, time.Second, 10*time.Millisecond) + }, 3*time.Second, 10*time.Millisecond) }