Test cleanup
This commit is contained in:
parent
0eba6888c1
commit
c839739320
@ -23,6 +23,12 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
testCtx = context.Background()
|
testCtx = context.Background()
|
||||||
|
teardownStatements = []string{
|
||||||
|
`TRUNCATE eth.header_cids`,
|
||||||
|
`TRUNCATE eth.state_cids`,
|
||||||
|
`TRUNCATE eth.storage_cids`,
|
||||||
|
`TRUNCATE ipld.blocks`,
|
||||||
|
}
|
||||||
|
|
||||||
// Fixture data
|
// Fixture data
|
||||||
// block one: contract account and slot are created
|
// block one: contract account and slot are created
|
||||||
@ -96,13 +102,7 @@ func TestPGXSuite(t *testing.T) {
|
|||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
tx, err := pool.Begin(testCtx)
|
tx, err := pool.Begin(testCtx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
statements := []string{
|
for _, stm := range teardownStatements {
|
||||||
`TRUNCATE eth.header_cids`,
|
|
||||||
`TRUNCATE eth.state_cids`,
|
|
||||||
`TRUNCATE eth.storage_cids`,
|
|
||||||
`TRUNCATE ipld.blocks`,
|
|
||||||
}
|
|
||||||
for _, stm := range statements {
|
|
||||||
_, err = tx.Exec(testCtx, stm)
|
_, err = tx.Exec(testCtx, stm)
|
||||||
require.NoErrorf(t, err, "Exec(`%s`)", stm)
|
require.NoErrorf(t, err, "Exec(`%s`)", stm)
|
||||||
}
|
}
|
||||||
@ -127,13 +127,7 @@ func TestSQLXSuite(t *testing.T) {
|
|||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
tx, err := pool.Begin()
|
tx, err := pool.Begin()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
statements := []string{
|
for _, stm := range teardownStatements {
|
||||||
`TRUNCATE eth.header_cids`,
|
|
||||||
`TRUNCATE eth.state_cids`,
|
|
||||||
`TRUNCATE eth.storage_cids`,
|
|
||||||
`TRUNCATE ipld.blocks`,
|
|
||||||
}
|
|
||||||
for _, stm := range statements {
|
|
||||||
_, err = tx.Exec(stm)
|
_, err = tx.Exec(stm)
|
||||||
require.NoErrorf(t, err, "Exec(`%s`)", stm)
|
require.NoErrorf(t, err, "Exec(`%s`)", stm)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user