diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9cdd995b38..80e138ef09 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -27,6 +27,7 @@ jobs: github.com/ChainSafe/gossamer/dot/core, github.com/ChainSafe/gossamer/dot/rpc/modules, github.com/ChainSafe/gossamer/lib/babe, + github.com/ChainSafe/gossamer/dot/sync, ] runs-on: ubuntu-latest steps: diff --git a/dot/sync/bootstrap_syncer_test.go b/dot/sync/bootstrap_syncer_integration_test.go similarity index 98% rename from dot/sync/bootstrap_syncer_test.go rename to dot/sync/bootstrap_syncer_integration_test.go index c49438921d..281f191f3f 100644 --- a/dot/sync/bootstrap_syncer_test.go +++ b/dot/sync/bootstrap_syncer_integration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only diff --git a/dot/sync/chain_processor_test.go b/dot/sync/chain_processor_integration_test.go similarity index 99% rename from dot/sync/chain_processor_test.go rename to dot/sync/chain_processor_integration_test.go index 9f3e1c80a6..f875edfa34 100644 --- a/dot/sync/chain_processor_test.go +++ b/dot/sync/chain_processor_integration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only diff --git a/dot/sync/chain_sync_test.go b/dot/sync/chain_sync_integeration_test.go similarity index 99% rename from dot/sync/chain_sync_test.go rename to dot/sync/chain_sync_integeration_test.go index 07dca3337d..b742226705 100644 --- a/dot/sync/chain_sync_test.go +++ b/dot/sync/chain_sync_integeration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only diff --git a/dot/sync/disjoint_block_set_test.go b/dot/sync/disjoint_block_set_integeration_test.go similarity index 99% rename from dot/sync/disjoint_block_set_test.go rename to dot/sync/disjoint_block_set_integeration_test.go index 2f909d2aba..afcd7458b3 100644 --- a/dot/sync/disjoint_block_set_test.go +++ b/dot/sync/disjoint_block_set_integeration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only diff --git a/dot/sync/message_test.go b/dot/sync/message_integeration_test.go similarity index 99% rename from dot/sync/message_test.go rename to dot/sync/message_integeration_test.go index 22b619d8aa..ac0f34f096 100644 --- a/dot/sync/message_test.go +++ b/dot/sync/message_integeration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only diff --git a/dot/sync/outliers_test.go b/dot/sync/outliers_integeration_test.go similarity index 91% rename from dot/sync/outliers_test.go rename to dot/sync/outliers_integeration_test.go index d5c8a818ca..86d5313094 100644 --- a/dot/sync/outliers_test.go +++ b/dot/sync/outliers_integeration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only diff --git a/dot/sync/syncer_test.go b/dot/sync/syncer_integeration_test.go similarity index 95% rename from dot/sync/syncer_test.go rename to dot/sync/syncer_integeration_test.go index 7f1d37aced..aac17d73e3 100644 --- a/dot/sync/syncer_test.go +++ b/dot/sync/syncer_integeration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only @@ -9,11 +12,10 @@ import ( "path/filepath" "testing" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/mock" - "github.com/ChainSafe/gossamer/dot/state" + "github.com/ChainSafe/gossamer/dot/sync/mocks" "github.com/ChainSafe/gossamer/dot/types" + "github.com/ChainSafe/gossamer/internal/log" "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" "github.com/ChainSafe/gossamer/lib/runtime" @@ -21,11 +23,9 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime/wasmer" "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" - - "github.com/ChainSafe/gossamer/internal/log" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - - "github.com/ChainSafe/gossamer/dot/sync/mocks" ) func TestMain(m *testing.M) { @@ -63,23 +63,21 @@ func newMockNetwork() *mocks.Network { } //go:generate mockgen -destination=mock_telemetry_test.go -package $GOPACKAGE github.com/ChainSafe/gossamer/dot/telemetry Client - func newTestSyncer(t *testing.T) *Service { - wasmer.DefaultTestLogLvl = 3 ctrl := gomock.NewController(t) - telemetryMock := NewMockClient(ctrl) - telemetryMock.EXPECT().SendMessage(gomock.Any()).AnyTimes() - cfg := &Config{ - Telemetry: telemetryMock, - } + mockTelemetryClient := NewMockClient(ctrl) + mockTelemetryClient.EXPECT().SendMessage(gomock.Any()).AnyTimes() + + wasmer.DefaultTestLogLvl = log.Warn + cfg := &Config{} testDatadirPath := t.TempDir() scfg := state.Config{ Path: testDatadirPath, LogLevel: log.Info, - Telemetry: telemetryMock, + Telemetry: mockTelemetryClient, } stateSrvc := state.NewService(scfg) stateSrvc.UseMemDB() @@ -148,6 +146,7 @@ func newTestSyncer(t *testing.T) *Service { cfg.LogLvl = log.Trace cfg.FinalityGadget = newMockFinalityGadget() cfg.Network = newMockNetwork() + cfg.Telemetry = mockTelemetryClient syncer, err := NewService(cfg) require.NoError(t, err) diff --git a/dot/sync/tip_syncer_test.go b/dot/sync/tip_syncer_integeration_test.go similarity index 98% rename from dot/sync/tip_syncer_test.go rename to dot/sync/tip_syncer_integeration_test.go index 79569c06cd..b24c0c4dc9 100644 --- a/dot/sync/tip_syncer_test.go +++ b/dot/sync/tip_syncer_integeration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + // Copyright 2021 ChainSafe Systems (ON) // SPDX-License-Identifier: LGPL-3.0-only @@ -32,7 +35,6 @@ func newTestTipSyncer(t *testing.T) *tipSyncer { readyBlocks: readyBlocks, pendingBlocks: pendingBlocks, } - return newTipSyncer(bs, pendingBlocks, readyBlocks, cs.handleReadyBlock) } @@ -163,7 +165,7 @@ func TestTipSyncer_handleTick_case1(t *testing.T) { fin, _ := s.blockState.GetHighestFinalisedHeader() - // add pending blocks w/ only hash and number, equal or lower than finalised should be removed + // add pending blocks w/ only hash and number, lower than finalised should be removed s.pendingBlocks.addHashAndNumber(common.Hash{0xa}, fin.Number) s.pendingBlocks.addHashAndNumber(common.Hash{0xb}, fin.Number+1)