@@ -144,6 +144,7 @@ func (i *indexCoreTest) setStoreEvents(f func(*testing.T, flow.Identifier, []flo
144144 return i
145145}
146146
147+
147148func (i * indexCoreTest ) setStoreTransactionResults (f func (* testing.T , flow.Identifier , []flow.LightTransactionResult ) error ) * indexCoreTest {
148149 i .results .
149150 On ("BatchStore" , mock .Anything , mock .Anything , mock .AnythingOfType ("flow.Identifier" ), mock .AnythingOfType ("[]flow.LightTransactionResult" )).
@@ -257,8 +258,18 @@ func TestExecutionState_IndexBlockData(t *testing.T) {
257258 t .Run ("Index AllTheThings" , func (t * testing.T ) {
258259 test := newIndexCoreTest (t , g , blocks , tf .ExecutionDataEntity ()).initIndexer ()
259260
260- test .events .On ("BatchStore" , mock .Anything , []flow.EventsList {tf .ExpectedEvents }, mock .Anything ).Return (nil )
261- test .results .On ("BatchStore" , mock .Anything , mock .Anything , blockID , tf .ExpectedResults ).Return (nil )
261+ test .events .On ("BatchStore" , mock .Anything , []flow.EventsList {tf .ExpectedEvents }, mock .Anything ).
262+ Return (func (blockID flow.Identifier , events []flow.EventsList , batch storage.ReaderBatchWriter ) error {
263+ require .NotNil (t , batch )
264+ // Events BatchStore doesn't require specific locks, but we validate the batch is provided
265+ return nil
266+ })
267+ test .results .On ("BatchStore" , mock .Anything , mock .Anything , blockID , tf .ExpectedResults ).
268+ Return (func (lctx lockctx.Proof , batch storage.ReaderBatchWriter , blockID flow.Identifier , results []flow.LightTransactionResult ) error {
269+ require .True (t , lctx .HoldsLock (storage .LockInsertLightTransactionResult ))
270+ require .NotNil (t , batch )
271+ return nil
272+ })
262273 test .registers .
263274 On ("Store" , mock .Anything , tf .Block .Height ).
264275 Run (func (args mock.Arguments ) {
@@ -271,7 +282,12 @@ func TestExecutionState_IndexBlockData(t *testing.T) {
271282 test .collections .On ("StoreAndIndexByTransaction" , mock .Anything , collection ).Return (& flow.LightCollection {}, nil )
272283 }
273284 for txID , scheduledTxID := range tf .ExpectedScheduledTransactions {
274- test .scheduledTransactions .On ("BatchIndex" , mock .Anything , blockID , txID , scheduledTxID , mock .Anything ).Return (nil )
285+ test .scheduledTransactions .On ("BatchIndex" , mock .Anything , blockID , txID , scheduledTxID , mock .Anything ).
286+ Return (func (lctx lockctx.Proof , blockID flow.Identifier , txID flow.Identifier , scheduledTxID uint64 , batch storage.ReaderBatchWriter ) error {
287+ require .True (t , lctx .HoldsLock (storage .LockIndexScheduledTransaction ))
288+ require .NotNil (t , batch )
289+ return nil
290+ })
275291 }
276292
277293 err := test .indexer .IndexBlockData (tf .ExecutionDataEntity ())
0 commit comments