Skip to content
Merged
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Comment thread
qdm12 marked this conversation as resolved.
]
runs-on: ubuntu-latest
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand Down
29 changes: 14 additions & 15 deletions dot/sync/syncer_test.go → dot/sync/syncer_integeration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand All @@ -9,23 +12,20 @@ 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"
rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage"
"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) {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

Expand Down Expand Up @@ -32,7 +35,6 @@ func newTestTipSyncer(t *testing.T) *tipSyncer {
readyBlocks: readyBlocks,
pendingBlocks: pendingBlocks,
}

return newTipSyncer(bs, pendingBlocks, readyBlocks, cs.handleReadyBlock)
}

Expand Down Expand Up @@ -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)

Expand Down