From 5badae04d1f7d3e74ba106f83c2ce3d4b0d92233 Mon Sep 17 00:00:00 2001 From: rian Date: Thu, 9 Jan 2025 14:21:32 +0200 Subject: [PATCH] fixed tests --- mempool/init_test.go | 5 ----- mempool/mempool.go | 2 -- mempool/mempool_test.go | 7 +++++-- 3 files changed, 5 insertions(+), 9 deletions(-) delete mode 100644 mempool/init_test.go diff --git a/mempool/init_test.go b/mempool/init_test.go deleted file mode 100644 index 3104ea09e7..0000000000 --- a/mempool/init_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package mempool_test - -import ( - _ "github.com/NethermindEth/juno/encoder/registry" -) diff --git a/mempool/mempool.go b/mempool/mempool.go index 9f0c976d41..39fdd02d3b 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -158,12 +158,10 @@ func (p *Pool) handleTransaction(userTxn *BroadcastedTransaction) error { if tailValue != nil { // Update old tail to point to the new item var oldTailElem storageElem - fmt.Println(" - error here") oldTailElem, err := p.dbElem(dbTxn, tailValue) if err != nil { return err } - fmt.Println(" - error here solved") oldTailElem.NextHash = userTxn.Transaction.Hash() if err = p.putdbElem(dbTxn, tailValue, &oldTailElem); err != nil { return err diff --git a/mempool/mempool_test.go b/mempool/mempool_test.go index 25b0fbfd5e..72c6d0d9dd 100644 --- a/mempool/mempool_test.go +++ b/mempool/mempool_test.go @@ -9,6 +9,7 @@ import ( "github.com/NethermindEth/juno/core/felt" "github.com/NethermindEth/juno/db" "github.com/NethermindEth/juno/db/pebble" + _ "github.com/NethermindEth/juno/encoder/registry" "github.com/NethermindEth/juno/mempool" "github.com/NethermindEth/juno/mocks" "github.com/NethermindEth/juno/utils" @@ -150,7 +151,7 @@ func TestRestoreMempool(t *testing.T) { } // check the db has stored the transactions - time.Sleep(4000 * time.Millisecond) + time.Sleep(100 * time.Millisecond) lenDB, err = pool.LenDB() require.NoError(t, err) require.Equal(t, uint16(3), lenDB) @@ -181,7 +182,9 @@ func TestRestoreMempool(t *testing.T) { func TestWait(t *testing.T) { log := utils.NewNopZapLogger() - testDB := pebble.NewMemTest(t) + testDB, dbCloser, err := setupDatabase("testwait", true) + require.NoError(t, err) + defer dbCloser() mockCtrl := gomock.NewController(t) t.Cleanup(mockCtrl.Finish) state := mocks.NewMockStateHistoryReader(mockCtrl)