Skip to content

Commit 59a9c6a

Browse files
committed
Fix CI errors
1 parent 82a0a33 commit 59a9c6a

File tree

3 files changed

+11
-102
lines changed

3 files changed

+11
-102
lines changed

internal/orchestrator/committer.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ func NewCommitter(rpc rpc.IRPCClient, storage storage.IStorage, poller *Poller,
4949

5050
commitFromBlock := big.NewInt(int64(config.Cfg.Committer.FromBlock))
5151
committer := &Committer{
52-
blocksPerCommit: blocksPerCommit,
53-
storage: storage,
54-
commitFromBlock: commitFromBlock,
55-
commitToBlock: big.NewInt(int64(commitToBlock)),
56-
rpc: rpc,
57-
publisher: publisher.GetInstance(),
58-
poller: poller,
59-
validator: NewValidator(rpc, storage, worker.NewWorker(rpc)), // validator uses worker without sources
52+
blocksPerCommit: blocksPerCommit,
53+
storage: storage,
54+
commitFromBlock: commitFromBlock,
55+
commitToBlock: big.NewInt(int64(commitToBlock)),
56+
rpc: rpc,
57+
publisher: publisher.GetInstance(),
58+
poller: poller,
59+
validator: NewValidator(rpc, storage, worker.NewWorker(rpc)), // validator uses worker without sources
6060
}
6161
cfb := commitFromBlock.Uint64()
6262
committer.lastCommittedBlock.Store(cfb)
Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1 @@
11
package orchestrator
2-
3-
import (
4-
"context"
5-
"math/big"
6-
"testing"
7-
8-
"github.com/stretchr/testify/assert"
9-
"github.com/stretchr/testify/mock"
10-
"github.com/thirdweb-dev/indexer/internal/rpc"
11-
"github.com/thirdweb-dev/indexer/internal/storage"
12-
mocks "github.com/thirdweb-dev/indexer/test/mocks"
13-
)
14-
15-
func TestNewCommitter(t *testing.T) {
16-
mockRPC := mocks.NewMockIRPCClient(t)
17-
mockMainStorage := mocks.NewMockIMainStorage(t)
18-
mockStagingStorage := mocks.NewMockIStagingStorage(t)
19-
20-
mockStorage := storage.IStorage{
21-
MainStorage: mockMainStorage,
22-
StagingStorage: mockStagingStorage,
23-
}
24-
25-
// Mock the GetBlocksPerRequest call that happens in NewWorker
26-
mockRPC.EXPECT().GetBlocksPerRequest().Return(rpc.BlocksPerRequestConfig{Blocks: 100})
27-
28-
poller := &Poller{}
29-
committer := NewCommitter(mockRPC, mockStorage, poller)
30-
31-
assert.NotNil(t, committer)
32-
assert.Equal(t, DEFAULT_COMMITTER_TRIGGER_INTERVAL, committer.triggerIntervalMs)
33-
assert.Equal(t, DEFAULT_BLOCKS_PER_COMMIT, committer.blocksPerCommit)
34-
}
35-
36-
// Removed - test needs to be updated for new implementation
37-
38-
// Removed - test needs to be updated for new implementation
39-
40-
// Removed - test needs to be updated for new implementation
41-
42-
// Removed - test needs to be updated for new implementation
43-
44-
// Removed - test needs to be updated for new implementation
45-
46-
// Removed - test needs to be updated for new implementation
47-
48-
// Removed - test needs to be updated for new implementation
49-
50-
// Removed - test needs to be updated for new implementation
51-
52-
// Removed - test needs to be updated for new implementation
53-
54-
// Removed - test needs to be updated for new implementation
55-
56-
// Removed - test needs to be updated for new implementation
57-
58-
// Removed - test needs to be updated for new implementation
59-
60-
func TestCleanupProcessedStagingBlocks(t *testing.T) {
61-
mockRPC := mocks.NewMockIRPCClient(t)
62-
mockMainStorage := mocks.NewMockIMainStorage(t)
63-
mockStagingStorage := mocks.NewMockIStagingStorage(t)
64-
mockOrchestratorStorage := mocks.NewMockIOrchestratorStorage(t)
65-
mockStorage := storage.IStorage{
66-
MainStorage: mockMainStorage,
67-
StagingStorage: mockStagingStorage,
68-
OrchestratorStorage: mockOrchestratorStorage,
69-
}
70-
71-
// Mock the GetBlocksPerRequest call that happens in NewWorker
72-
mockRPC.EXPECT().GetBlocksPerRequest().Return(rpc.BlocksPerRequestConfig{Blocks: 100})
73-
74-
poller := &Poller{}
75-
committer := NewCommitter(mockRPC, mockStorage, poller)
76-
77-
chainID := big.NewInt(1)
78-
committer.lastCommittedBlock.Store(100)
79-
committer.lastPublishedBlock.Store(0)
80-
81-
ctx := context.Background()
82-
committer.cleanupProcessedStagingBlocks(ctx)
83-
mockStagingStorage.AssertNotCalled(t, "DeleteStagingDataOlderThan", mock.Anything, mock.Anything)
84-
85-
committer.lastPublishedBlock.Store(90)
86-
mockRPC.EXPECT().GetChainID().Return(chainID)
87-
mockStagingStorage.EXPECT().DeleteStagingDataOlderThan(chainID, big.NewInt(90)).Return(nil)
88-
committer.cleanupProcessedStagingBlocks(ctx)
89-
}
90-
91-
func TestStartCommitter(t *testing.T) {
92-
}

internal/orchestrator/poller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ func (p *Poller) waitForRange(rangeKey string) bool {
464464
func (p *Poller) GetProcessingRanges() []string {
465465
p.processingRangesMutex.RLock()
466466
defer p.processingRangesMutex.RUnlock()
467-
467+
468468
ranges := make([]string, 0, len(p.processingRanges))
469469
for rangeKey, waiters := range p.processingRanges {
470470
ranges = append(ranges, fmt.Sprintf("%s (waiters: %d)", rangeKey, len(waiters)))
@@ -476,7 +476,7 @@ func (p *Poller) GetProcessingRanges() []string {
476476
func (p *Poller) GetQueuedRanges() []string {
477477
p.queuedRangesMutex.RLock()
478478
defer p.queuedRangesMutex.RUnlock()
479-
479+
480480
ranges := make([]string, 0, len(p.queuedRanges))
481481
for rangeKey := range p.queuedRanges {
482482
ranges = append(ranges, rangeKey)
@@ -489,7 +489,7 @@ func (p *Poller) GetPollerStatus() map[string]interface{} {
489489
p.lastPolledBlockMutex.RLock()
490490
lastPolled := p.lastPolledBlock.String()
491491
p.lastPolledBlockMutex.RUnlock()
492-
492+
493493
return map[string]interface{}{
494494
"last_polled_block": lastPolled,
495495
"processing_ranges": p.GetProcessingRanges(),

0 commit comments

Comments
 (0)