From 65e10f5bf2d5fac0dee3876d3ababe470fd6c061 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik Date: Thu, 7 Apr 2022 14:57:14 +0700 Subject: [PATCH] cleanup Signed-off-by: Nikita Skrynnik --- .github/workflows/ci.yaml | 4 ++-- pkg/registry/common/refresh/nse_registry_client.go | 3 --- .../common/refresh/nse_registry_client_test.go | 11 ++--------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d086c9fda3..0652fbfbf9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Check out code uses: actions/checkout@v2 @@ -33,7 +33,7 @@ jobs: - name: Build run: go build -race ./... - name: Test - run: go test -race ./... -run Test_RefreshNSEClient_SetsCorrectExpireTime -count 10000 -timeout 2000m + run: go test -race ./... -run Test_RefreshNSEClient_SetsCorrectExpireTime -count 100 -timeout 2000m golangci-lint: name: golangci-lint runs-on: ubuntu-latest diff --git a/pkg/registry/common/refresh/nse_registry_client.go b/pkg/registry/common/refresh/nse_registry_client.go index f4a233d37e..ce154c377e 100644 --- a/pkg/registry/common/refresh/nse_registry_client.go +++ b/pkg/registry/common/refresh/nse_registry_client.go @@ -27,7 +27,6 @@ import ( "github.com/networkservicemesh/sdk/pkg/registry/common/begin" "github.com/networkservicemesh/sdk/pkg/registry/core/next" "github.com/networkservicemesh/sdk/pkg/tools/clock" - "github.com/networkservicemesh/sdk/pkg/tools/log" ) type refreshNSEClient struct { @@ -70,9 +69,7 @@ func (c *refreshNSEClient) Register(ctx context.Context, nse *registry.NetworkSe case <-refreshCtx.Done(): return case <-refreshCh: - log.FromContext(c.ctx).Infof("[REFRESH] Reregister begin") <-factory.Register(begin.CancelContext(refreshCtx)) - log.FromContext(c.ctx).Infof("[REFRESH] Reregister end") } }() } diff --git a/pkg/registry/common/refresh/nse_registry_client_test.go b/pkg/registry/common/refresh/nse_registry_client_test.go index 071ba4db75..629e8f15e5 100644 --- a/pkg/registry/common/refresh/nse_registry_client_test.go +++ b/pkg/registry/common/refresh/nse_registry_client_test.go @@ -39,13 +39,11 @@ import ( "github.com/networkservicemesh/sdk/pkg/tools/clock" "github.com/networkservicemesh/sdk/pkg/tools/clockmock" "github.com/networkservicemesh/sdk/pkg/tools/interdomain" - "github.com/networkservicemesh/sdk/pkg/tools/log" - "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" ) const ( expireTimeout = 3 * time.Minute - testWait = 400 * time.Millisecond + testWait = 100 * time.Millisecond testTick = testWait / 100 ) @@ -228,9 +226,6 @@ func Test_RefreshNSEClient_SetsCorrectExpireTime(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - logger := logruslogger.New(ctx) - ctx = log.WithLog(ctx, logger) - clockMock := clockmock.New(ctx) ctx = clock.WithClock(ctx, clockMock) @@ -251,11 +246,9 @@ func Test_RefreshNSEClient_SetsCorrectExpireTime(t *testing.T) { count := int32(i) clockMock.Add(expireTimeout / 3 * 2) - logger.Info("[TEST] require.Eventually begin") require.Eventually(t, func() bool { return atomic.LoadInt32(&countClient.requestCount) > count - }, testWait, testTick) - logger.Info("[TEST] require.Eventually end") + }, 4*testWait, testTick) // Wait for the Refresh to fully happen time.Sleep(testWait)