ref. integrity tests - set up once and rollback tx for each case

runs faster with equivalent degree of isolation - tests were hitting default 10m timeout
This commit is contained in:
Roy Crihfield 2023-09-09 17:10:31 +08:00
parent 911f6f7ef8
commit 483bc3f997

View File

@ -24,13 +24,13 @@ func TestRefIntegrity(t *testing.T) {
RunSpecs(t, "ETH IPLD validator ref integrity suite test") RunSpecs(t, "ETH IPLD validator ref integrity suite test")
} }
var _ = Describe("referential integrity", func() { var _ = Describe("referential integrity", Ordered, func() {
var ( var (
db *sqlx.DB db *sqlx.DB
tx *sqlx.Tx tx *sqlx.Tx
checkedBlock *types.Block // Generated block of interest checkedBlock *types.Block // Generated block of interest
) )
BeforeEach(func() { BeforeAll(func() {
var ( var (
blocks []*types.Block blocks []*types.Block
receipts []types.Receipts receipts []types.Receipts
@ -66,12 +66,12 @@ var _ = Describe("referential integrity", func() {
checkedBlock = blocks[5] checkedBlock = blocks[5]
db = helpers.SetupDB() db = helpers.SetupDB()
tx = db.MustBegin()
}) })
AfterAll(func() { helpers.TearDownDB(db) })
BeforeEach(func() { tx = db.MustBegin() })
AfterEach(func() { AfterEach(func() {
tx.Rollback() tx.Rollback()
helpers.TearDownDB(db)
}) })
Describe("ValidateHeaderCIDsRef", func() { Describe("ValidateHeaderCIDsRef", func() {