Add new test with CopyFrom enabled.

This commit is contained in:
Thomas E Lackey 2023-03-08 18:25:11 -06:00
parent ece2696c9e
commit 1b20ccf4cd

View File

@ -29,8 +29,8 @@ import (
"github.com/ethereum/go-ethereum/statediff/indexer/test"
)
func setupPGXIndexer(t *testing.T) {
db, err = postgres.SetupPGXDB(postgres.DefaultConfig)
func setupPGXIndexer(t *testing.T, config postgres.Config) {
db, err = postgres.SetupPGXDB(config)
if err != nil {
t.Fatal(err)
}
@ -39,12 +39,16 @@ func setupPGXIndexer(t *testing.T) {
}
func setupPGX(t *testing.T) {
setupPGXIndexer(t)
setupPGXWithConfig(t, postgres.DefaultConfig)
}
func setupPGXWithConfig(t *testing.T, config postgres.Config) {
setupPGXIndexer(t, config)
test.SetupTestData(t, ind)
}
func setupPGXNonCanonical(t *testing.T) {
setupPGXIndexer(t)
setupPGXIndexer(t, postgres.DefaultConfig)
test.SetupTestDataNonCanonical(t, ind)
}
@ -97,6 +101,20 @@ func TestPGXIndexer(t *testing.T) {
test.TestPublishAndIndexStorageIPLDs(t, db)
})
t.Run("Publish and index with CopyFrom enabled.", func(t *testing.T) {
config := postgres.DefaultConfig
config.CopyFrom = true
setupPGXWithConfig(t, config)
defer tearDown(t)
defer checkTxClosure(t, 1, 0, 1)
test.TestPublishAndIndexStateIPLDs(t, db)
test.TestPublishAndIndexStorageIPLDs(t, db)
test.TestPublishAndIndexReceiptIPLDs(t, db)
test.TestPublishAndIndexLogIPLDs(t, db)
})
}
// Test indexer for a canonical + a non-canonical block at London height + a non-canonical block at London height + 1
@ -151,7 +169,7 @@ func TestPGXIndexerNonCanonical(t *testing.T) {
}
func TestPGXWatchAddressMethods(t *testing.T) {
setupPGXIndexer(t)
setupPGXIndexer(t, postgres.DefaultConfig)
defer tearDown(t)
defer checkTxClosure(t, 1, 0, 1)