Skip to content

Commit

Permalink
block_test.go: Remove unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjat committed Aug 24, 2023
1 parent f7f98f6 commit b458307
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions analyzer/block/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ var testFastSyncBlockBasedConfig = &config.BlockBasedAnalyzerConfig{
}

type mockProcessor struct {
name string
latestBlockHeight uint64
processedBlocks map[uint64]struct{}
processedOrder []uint64
storage storage.TargetStorage
name string
processedBlocks map[uint64]struct{}
processedOrder []uint64
storage storage.TargetStorage

fail func(uint64) error
}
Expand Down Expand Up @@ -153,7 +152,7 @@ func TestFastSyncBlockAnalyzer(t *testing.T) {
ctx := context.Background()

db := setupDB(t)
p := &mockProcessor{name: "test-analyzer", latestBlockHeight: 10_000, storage: db}
p := &mockProcessor{name: "test-analyzer", storage: db}
analyzer := setupAnalyzer(t, db, p, testBlockBasedConfig, analyzer.SlowSyncMode)

// Run the analyzer and ensure all blocks are processed.
Expand Down Expand Up @@ -189,7 +188,7 @@ func TestMultipleFastSyncBlockAnalyzers(t *testing.T) {
ps := []*mockProcessor{}
as := []analyzer.Analyzer{}
for i := 0; i < numAnalyzers; i++ {
p := &mockProcessor{name: "test-analyzer", latestBlockHeight: 10_000, storage: db}
p := &mockProcessor{name: "test-analyzer", storage: db}
analyzer := setupAnalyzer(t, db, p, testFastSyncBlockBasedConfig, analyzer.FastSyncMode)
ps = append(ps, p)
as = append(as, analyzer)
Expand Down Expand Up @@ -239,7 +238,7 @@ func TestFailingFastSyncBlockAnalyzers(t *testing.T) {
return fmt.Errorf("failing analyzer")
}
}
p := &mockProcessor{name: "test-analyzer", latestBlockHeight: 10_000, storage: db, fail: fail}
p := &mockProcessor{name: "test-analyzer", storage: db, fail: fail}
analyzer := setupAnalyzer(t, db, p, testFastSyncBlockBasedConfig, analyzer.FastSyncMode)
ps = append(ps, p)
as = append(as, analyzer)
Expand Down Expand Up @@ -282,7 +281,7 @@ func TestDistinctFastSyncBlockAnalyzers(t *testing.T) {
ps := []*mockProcessor{}
as := []analyzer.Analyzer{}
for i := 0; i < numAnalyzers; i++ {
p := &mockProcessor{name: fmt.Sprintf("test-analyzer-%d", i), latestBlockHeight: 1_000, storage: db}
p := &mockProcessor{name: fmt.Sprintf("test-analyzer-%d", i), storage: db}
analyzer := setupAnalyzer(t, db, p, testFastSyncBlockBasedConfig, analyzer.FastSyncMode)
ps = append(ps, p)
as = append(as, analyzer)
Expand Down Expand Up @@ -319,7 +318,7 @@ func TestSlowSyncBlockAnalyzer(t *testing.T) {
ctx := context.Background()

db := setupDB(t)
p := &mockProcessor{name: "test-analyzer", latestBlockHeight: 10_000, storage: db}
p := &mockProcessor{name: "test-analyzer", storage: db}
analyzer := setupAnalyzer(t, db, p, testBlockBasedConfig, analyzer.SlowSyncMode)

// Run the analyzer and ensure all blocks are processed.
Expand Down Expand Up @@ -352,7 +351,7 @@ func TestFailingSlowSyncBlockAnalyzer(t *testing.T) {
ctx := context.Background()

db := setupDB(t)
p := &mockProcessor{name: "test-analyzer", latestBlockHeight: 10_000, storage: db, fail: func(height uint64) error {
p := &mockProcessor{name: "test-analyzer", storage: db, fail: func(height uint64) error {
// Fail ~5% of the time.
if rand.Float64() > 0.95 { // /nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand).
return fmt.Errorf("failed by chance")
Expand Down Expand Up @@ -395,7 +394,7 @@ func TestDistinctSlowSyncBlockAnalyzers(t *testing.T) {
ps := []*mockProcessor{}
as := []analyzer.Analyzer{}
for i := 0; i < numAnalyzers; i++ {
p := &mockProcessor{name: fmt.Sprintf("test-analyzer-%d", i), latestBlockHeight: 1_000, storage: db}
p := &mockProcessor{name: fmt.Sprintf("test-analyzer-%d", i), storage: db}
analyzer := setupAnalyzer(t, db, p, testBlockBasedConfig, analyzer.SlowSyncMode)
ps = append(ps, p)
as = append(as, analyzer)
Expand Down

0 comments on commit b458307

Please sign in to comment.