diff --git a/statediff/indexer/database/sql/pgx_indexer_test.go b/statediff/indexer/database/sql/pgx_indexer_test.go index c3a758b01..c0ce57c1f 100644 --- a/statediff/indexer/database/sql/pgx_indexer_test.go +++ b/statediff/indexer/database/sql/pgx_indexer_test.go @@ -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)