Skip to content

Commit 97345be

Browse files
committed
fix mock
1 parent c0a38c7 commit 97345be

10 files changed

Lines changed: 195 additions & 188 deletions

.mockery.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ packages:
4848
filename: external/hstore.go
4949
github.com/evstack/ev-node/block/internal/syncing:
5050
interfaces:
51-
DaRetrieverI:
52-
config:
53-
dir: ./block/internal/syncing
54-
pkgname: syncing
55-
filename: syncer_mock.go
5651
p2pHandler:
5752
config:
5853
dir: ./block/internal/syncing
@@ -65,3 +60,8 @@ packages:
6560
dir: ./block/internal/common
6661
pkgname: common
6762
filename: broadcaster_mock.go
63+
DARetriever:
64+
config:
65+
dir: ./block/internal/common
66+
pkgname: common
67+
filename: da_retriever_mock.go

block/internal/common/da_retriever_mock.go

Lines changed: 174 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

block/internal/executing/executor_lazy_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"github.com/evstack/ev-node/block/internal/cache"
1616
"github.com/evstack/ev-node/block/internal/common"
17-
"github.com/evstack/ev-node/block/internal/syncing"
1817
coreseq "github.com/evstack/ev-node/core/sequencer"
1918
"github.com/evstack/ev-node/pkg/config"
2019
"github.com/evstack/ev-node/pkg/genesis"
@@ -57,7 +56,7 @@ func TestLazyMode_ProduceBlockLogic(t *testing.T) {
5756
memStore,
5857
mockExec,
5958
mockSeq,
60-
syncing.NewMockDaRetrieverI(t),
59+
common.NewMockDARetriever(t),
6160
signerWrapper,
6261
cacheManager,
6362
metrics,
@@ -168,7 +167,7 @@ func TestRegularMode_ProduceBlockLogic(t *testing.T) {
168167
memStore,
169168
mockExec,
170169
mockSeq,
171-
syncing.NewMockDaRetrieverI(t),
170+
common.NewMockDARetriever(t),
172171
signerWrapper,
173172
cacheManager,
174173
metrics,

block/internal/executing/executor_logic_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616

1717
"github.com/evstack/ev-node/block/internal/cache"
1818
"github.com/evstack/ev-node/block/internal/common"
19-
"github.com/evstack/ev-node/block/internal/syncing"
2019
coreseq "github.com/evstack/ev-node/core/sequencer"
2120
"github.com/evstack/ev-node/pkg/config"
2221
"github.com/evstack/ev-node/pkg/genesis"
@@ -79,7 +78,7 @@ func TestProduceBlock_EmptyBatch_SetsEmptyDataHash(t *testing.T) {
7978
memStore,
8079
mockExec,
8180
mockSeq,
82-
syncing.NewMockDaRetrieverI(t),
81+
common.NewMockDARetriever(t),
8382
signerWrapper,
8483
cacheManager,
8584
metrics,
@@ -167,7 +166,7 @@ func TestPendingLimit_SkipsProduction(t *testing.T) {
167166
memStore,
168167
mockExec,
169168
mockSeq,
170-
syncing.NewMockDaRetrieverI(t),
169+
common.NewMockDARetriever(t),
171170
signerWrapper,
172171
cacheManager,
173172
metrics,

block/internal/executing/executor_restart_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"github.com/evstack/ev-node/block/internal/cache"
1616
"github.com/evstack/ev-node/block/internal/common"
17-
"github.com/evstack/ev-node/block/internal/syncing"
1817
coreseq "github.com/evstack/ev-node/core/sequencer"
1918
"github.com/evstack/ev-node/pkg/config"
2019
"github.com/evstack/ev-node/pkg/genesis"
@@ -57,7 +56,7 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
5756
memStore,
5857
mockExec1,
5958
mockSeq1,
60-
syncing.NewMockDaRetrieverI(t),
59+
common.NewMockDARetriever(t),
6160
signerWrapper,
6261
cacheManager,
6362
metrics,
@@ -177,7 +176,7 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) {
177176
memStore, // same store
178177
mockExec2,
179178
mockSeq2,
180-
syncing.NewMockDaRetrieverI(t),
179+
common.NewMockDARetriever(t),
181180
signerWrapper,
182181
cacheManager,
183182
metrics,
@@ -276,7 +275,7 @@ func TestExecutor_RestartNoPendingHeader(t *testing.T) {
276275
memStore,
277276
mockExec1,
278277
mockSeq1,
279-
syncing.NewMockDaRetrieverI(t),
278+
common.NewMockDARetriever(t),
280279
signerWrapper,
281280
cacheManager,
282281
metrics,
@@ -329,7 +328,7 @@ func TestExecutor_RestartNoPendingHeader(t *testing.T) {
329328
memStore,
330329
mockExec2,
331330
mockSeq2,
332-
syncing.NewMockDaRetrieverI(t),
331+
common.NewMockDARetriever(t),
333332
signerWrapper,
334333
cacheManager,
335334
metrics,

block/internal/executing/executor_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"github.com/evstack/ev-node/block/internal/cache"
1515
"github.com/evstack/ev-node/block/internal/common"
16-
"github.com/evstack/ev-node/block/internal/syncing"
1716
"github.com/evstack/ev-node/pkg/config"
1817
"github.com/evstack/ev-node/pkg/genesis"
1918
"github.com/evstack/ev-node/pkg/store"
@@ -49,7 +48,7 @@ func TestExecutor_BroadcasterIntegration(t *testing.T) {
4948
memStore,
5049
nil, // nil executor (we're not testing execution)
5150
nil, // nil sequencer (we're not testing sequencing)
52-
syncing.NewMockDaRetrieverI(t),
51+
common.NewMockDARetriever(t),
5352
testSigner, // test signer (required for executor)
5453
cacheManager,
5554
metrics,
@@ -100,7 +99,7 @@ func TestExecutor_NilBroadcasters(t *testing.T) {
10099
memStore,
101100
nil, // nil executor
102101
nil, // nil sequencer
103-
syncing.NewMockDaRetrieverI(t),
102+
common.NewMockDARetriever(t),
104103
testSigner, // test signer (required for executor)
105104
cacheManager,
106105
metrics,

block/internal/syncing/syncer_backoff_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestSyncer_BackoffOnDAError(t *testing.T) {
6969
syncer.ctx = ctx
7070

7171
// Setup mocks
72-
daRetriever := NewMockDaRetrieverI(t)
72+
daRetriever := common.NewMockDARetriever(t)
7373
p2pHandler := newMockp2pHandler(t)
7474
syncer.daRetriever = daRetriever
7575
syncer.p2pHandler = p2pHandler
@@ -167,7 +167,7 @@ func TestSyncer_BackoffResetOnSuccess(t *testing.T) {
167167
addr, pub, signer := buildSyncTestSigner(t)
168168
gen := syncer.genesis
169169

170-
daRetriever := NewMockDaRetrieverI(t)
170+
daRetriever := common.NewMockDARetriever(t)
171171
p2pHandler := newMockp2pHandler(t)
172172
syncer.daRetriever = daRetriever
173173
syncer.p2pHandler = p2pHandler
@@ -260,7 +260,7 @@ func TestSyncer_BackoffBehaviorIntegration(t *testing.T) {
260260
syncer := setupTestSyncer(t, 500*time.Millisecond)
261261
syncer.ctx = ctx
262262

263-
daRetriever := NewMockDaRetrieverI(t)
263+
daRetriever := common.NewMockDARetriever(t)
264264
p2pHandler := newMockp2pHandler(t)
265265
syncer.daRetriever = daRetriever
266266
syncer.p2pHandler = p2pHandler

block/internal/syncing/syncer_benchmark_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func newBenchFixture(b *testing.B, totalHeights uint64, shuffledTx bool, daDelay
131131
}
132132

133133
// Mock DA retriever to emit exactly totalHeights events, then HFF and cancel
134-
daR := NewMockDaRetrieverI(b)
134+
daR := common.NewMockDARetriever(b)
135135
for i := uint64(0); i < totalHeights; i++ {
136136
daHeight := i + daHeightOffset
137137
daR.On("RetrieveFromDA", mock.Anything, daHeight).

0 commit comments

Comments
 (0)