@@ -130,9 +130,11 @@ func TestCommit(t *testing.T) {
130130 mockRPC := mocks .NewMockIRPCClient (t )
131131 mockMainStorage := mocks .NewMockIMainStorage (t )
132132 mockStagingStorage := mocks .NewMockIStagingStorage (t )
133+ mockOrchestratorStorage := mocks .NewMockIOrchestratorStorage (t )
133134 mockStorage := storage.IStorage {
134- MainStorage : mockMainStorage ,
135- StagingStorage : mockStagingStorage ,
135+ MainStorage : mockMainStorage ,
136+ StagingStorage : mockStagingStorage ,
137+ OrchestratorStorage : mockOrchestratorStorage ,
136138 }
137139 committer := NewCommitter (mockRPC , mockStorage )
138140
@@ -141,6 +143,10 @@ func TestCommit(t *testing.T) {
141143 {Block : common.Block {Number : big .NewInt (102 )}},
142144 }
143145
146+ mockRPC .EXPECT ().GetChainID ().Return (big .NewInt (1 ))
147+ mockOrchestratorStorage .EXPECT ().SetCommittingLocked (big .NewInt (1 ), true ).Return (nil ).Once ()
148+ mockOrchestratorStorage .EXPECT ().IsCommittingLocked (big .NewInt (1 )).Return (false , nil )
149+ mockOrchestratorStorage .EXPECT ().SetCommittingLocked (big .NewInt (1 ), false ).Return (nil ).Once ()
144150 mockMainStorage .EXPECT ().InsertBlockData (& blockData ).Return (nil )
145151 mockStagingStorage .EXPECT ().DeleteStagingData (& blockData ).Return (nil )
146152
@@ -186,10 +192,12 @@ func TestStartCommitter(t *testing.T) {
186192 mockRPC := mocks .NewMockIRPCClient (t )
187193 mockMainStorage := mocks .NewMockIMainStorage (t )
188194 mockStagingStorage := mocks .NewMockIStagingStorage (t )
195+ mockOrchestratorStorage := mocks .NewMockIOrchestratorStorage (t )
189196
190197 mockStorage := storage.IStorage {
191- MainStorage : mockMainStorage ,
192- StagingStorage : mockStagingStorage ,
198+ MainStorage : mockMainStorage ,
199+ StagingStorage : mockStagingStorage ,
200+ OrchestratorStorage : mockOrchestratorStorage ,
193201 }
194202
195203 committer := NewCommitter (mockRPC , mockStorage )
@@ -198,6 +206,9 @@ func TestStartCommitter(t *testing.T) {
198206 chainID := big .NewInt (1 )
199207 mockRPC .EXPECT ().GetChainID ().Return (chainID )
200208 mockMainStorage .EXPECT ().GetMaxBlockNumber (chainID ).Return (big .NewInt (100 ), nil )
209+ mockOrchestratorStorage .EXPECT ().SetCommittingLocked (big .NewInt (1 ), true ).Return (nil )
210+ mockOrchestratorStorage .EXPECT ().IsCommittingLocked (big .NewInt (1 )).Return (false , nil )
211+ mockOrchestratorStorage .EXPECT ().SetCommittingLocked (big .NewInt (1 ), false ).Return (nil )
201212
202213 blockData := []common.BlockData {
203214 {Block : common.Block {Number : big .NewInt (101 )}},
@@ -218,9 +229,11 @@ func TestCommitterRespectsSIGTERM(t *testing.T) {
218229 mockRPC := mocks .NewMockIRPCClient (t )
219230 mockMainStorage := mocks .NewMockIMainStorage (t )
220231 mockStagingStorage := mocks .NewMockIStagingStorage (t )
232+ mockOrchestratorStorage := mocks .NewMockIOrchestratorStorage (t )
221233 mockStorage := storage.IStorage {
222- MainStorage : mockMainStorage ,
223- StagingStorage : mockStagingStorage ,
234+ MainStorage : mockMainStorage ,
235+ StagingStorage : mockStagingStorage ,
236+ OrchestratorStorage : mockOrchestratorStorage ,
224237 }
225238
226239 committer := NewCommitter (mockRPC , mockStorage )
@@ -229,6 +242,9 @@ func TestCommitterRespectsSIGTERM(t *testing.T) {
229242 chainID := big .NewInt (1 )
230243 mockRPC .EXPECT ().GetChainID ().Return (chainID )
231244 mockMainStorage .EXPECT ().GetMaxBlockNumber (chainID ).Return (big .NewInt (100 ), nil )
245+ mockOrchestratorStorage .EXPECT ().SetCommittingLocked (big .NewInt (1 ), true ).Return (nil )
246+ mockOrchestratorStorage .EXPECT ().IsCommittingLocked (big .NewInt (1 )).Return (false , nil )
247+ mockOrchestratorStorage .EXPECT ().SetCommittingLocked (big .NewInt (1 ), false ).Return (nil )
232248
233249 blockData := []common.BlockData {
234250 {Block : common.Block {Number : big .NewInt (101 )}},
0 commit comments