@@ -636,7 +636,6 @@ func (suite *Suite) TestGetExecutionResultByBlockID() {
636636// TestGetSealedTransaction tests that transactions status of transaction that belongs to a sealed block
637637// is reported as sealed
638638func (suite * Suite ) TestGetSealedTransaction () {
639- lockManager := storage .NewTestingLockManager ()
640639 unittest .RunWithBadgerDB (suite .T (), func (db * badger.DB ) {
641640 all := bstorage .InitAll (metrics .NewNoopCollector (), db )
642641 en := util .ExecutionStorageLayer (suite .T (), db )
@@ -772,11 +771,11 @@ func (suite *Suite) TestGetSealedTransaction() {
772771 lctx .Release ()
773772
774773 fctx := suite .lockManager .NewContext ()
775- defer fctx .Release ()
776774 require .NoError (suite .T (), fctx .AcquireLock (storage .LockFinalizeBlock ))
777775 require .NoError (suite .T (), bdb .WithReaderBatchWriter (func (rw storage.ReaderBatchWriter ) error {
778776 return operation .IndexFinalizedBlockByHeight (fctx , rw , block .Height , block .ID ())
779777 }))
778+ fctx .Release ()
780779
781780 suite .sealedBlock = block .ToHeader ()
782781
@@ -798,7 +797,7 @@ func (suite *Suite) TestGetSealedTransaction() {
798797 suite .request .On ("EntityByID" , collection .ID (), mock .Anything ).Return ()
799798 // 4. Indexer IndexCollection receives the requested collection and all the execution receipts
800799 // Create a lock context for indexing
801- indexLctx := lockManager .NewContext ()
800+ indexLctx := suite . lockManager .NewContext ()
802801 lockErr := indexLctx .AcquireLock (storage .LockInsertCollection )
803802 require .NoError (suite .T (), lockErr )
804803 defer indexLctx .Release ()
@@ -1149,7 +1148,6 @@ func (suite *Suite) TestGetTransactionResult() {
11491148// TestExecuteScript tests the three execute Script related calls to make sure that the execution api is called with
11501149// the correct block id
11511150func (suite * Suite ) TestExecuteScript () {
1152- lockManager := storage .NewTestingLockManager ()
11531151 unittest .RunWithBadgerDB (suite .T (), func (badgerdb * badger.DB ) {
11541152 db := badgerimpl .ToDB (badgerdb )
11551153 all := bstorage .InitAll (metrics .NewNoopCollector (), badgerdb )
@@ -1237,7 +1235,7 @@ func (suite *Suite) TestExecuteScript() {
12371235 all .Collections ,
12381236 all .Transactions ,
12391237 lastFullBlockHeight ,
1240- lockManager ,
1238+ suite . lockManager ,
12411239 )
12421240
12431241 ingestEng , err := ingestion .New (
@@ -1260,15 +1258,15 @@ func (suite *Suite) TestExecuteScript() {
12601258
12611259 // create a block and a seal pointing to that block
12621260 lastBlock := unittest .BlockWithParentFixture (prevBlock .ToHeader ())
1263- lctx := lockManager .NewContext ()
1261+ lctx := suite . lockManager .NewContext ()
12641262 require .NoError (suite .T (), lctx .AcquireLock (storage .LockInsertBlock ))
12651263 require .NoError (suite .T (), db .WithReaderBatchWriter (func (rw storage.ReaderBatchWriter ) error {
12661264 return all .Blocks .BatchStore (lctx , rw , unittest .ProposalFromBlock (lastBlock ))
12671265 }))
12681266 lctx .Release ()
12691267 require .NoError (suite .T (), err )
12701268
1271- fctx := lockManager .NewContext ()
1269+ fctx := suite . lockManager .NewContext ()
12721270 require .NoError (suite .T (), fctx .AcquireLock (storage .LockFinalizeBlock ))
12731271 require .NoError (suite .T (), db .WithReaderBatchWriter (func (rw storage.ReaderBatchWriter ) error {
12741272 return operation .IndexFinalizedBlockByHeight (fctx , rw , lastBlock .Height , lastBlock .ID ())
@@ -1285,7 +1283,7 @@ func (suite *Suite) TestExecuteScript() {
12851283 require .NoError (suite .T (), err )
12861284 }
12871285
1288- fctx2 := lockManager .NewContext ()
1286+ fctx2 := suite . lockManager .NewContext ()
12891287 require .NoError (suite .T (), fctx2 .AcquireLock (storage .LockInsertBlock ))
12901288 require .NoError (suite .T (), fctx2 .AcquireLock (storage .LockFinalizeBlock ))
12911289 require .NoError (suite .T (), db .WithReaderBatchWriter (func (rw storage.ReaderBatchWriter ) error {
0 commit comments