From 36e590c0926a2c2ffcec759a83979ec50500e5b5 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Wed, 18 May 2022 20:23:40 +0530 Subject: [PATCH] Delete from all tables when tearing down db for tests --- pkg/eth/backend.go | 1 - pkg/shared/test_helpers.go | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/eth/backend.go b/pkg/eth/backend.go index a8b4bda8..5cc1f878 100644 --- a/pkg/eth/backend.go +++ b/pkg/eth/backend.go @@ -59,7 +59,6 @@ var ( // errMissingSignature is returned if a block's extra-data section doesn't seem // to contain a 65 byte secp256k1 signature. - errMissingSignature = errors.New("extra-data 65 byte signature suffix missing") ) const ( diff --git a/pkg/shared/test_helpers.go b/pkg/shared/test_helpers.go index d9795b59..f8d32dbf 100644 --- a/pkg/shared/test_helpers.go +++ b/pkg/shared/test_helpers.go @@ -58,8 +58,12 @@ func SetupDB() *sqlx.DB { func TearDownDB(db *sqlx.DB) { tx, err := db.Beginx() Expect(err).NotTo(HaveOccurred()) + _, err = tx.Exec(`DELETE FROM nodes`) + Expect(err).NotTo(HaveOccurred()) _, err = tx.Exec(`DELETE FROM eth.header_cids`) Expect(err).NotTo(HaveOccurred()) + _, err = tx.Exec(`DELETE FROM eth.uncle_cids`) + Expect(err).NotTo(HaveOccurred()) _, err = tx.Exec(`DELETE FROM eth.transaction_cids`) Expect(err).NotTo(HaveOccurred()) _, err = tx.Exec(`DELETE FROM eth.receipt_cids`) @@ -68,6 +72,10 @@ func TearDownDB(db *sqlx.DB) { Expect(err).NotTo(HaveOccurred()) _, err = tx.Exec(`DELETE FROM eth.storage_cids`) Expect(err).NotTo(HaveOccurred()) + _, err = tx.Exec(`DELETE FROM eth.state_accounts`) + Expect(err).NotTo(HaveOccurred()) + _, err = tx.Exec(`DELETE FROM eth.access_list_elements`) + Expect(err).NotTo(HaveOccurred()) _, err = tx.Exec(`DELETE FROM blocks`) Expect(err).NotTo(HaveOccurred()) _, err = tx.Exec(`DELETE FROM eth.log_cids`)