diff --git a/source/logrepl/combined_test.go b/source/logrepl/combined_test.go index 4abca0d..6e1b5ec 100644 --- a/source/logrepl/combined_test.go +++ b/source/logrepl/combined_test.go @@ -165,16 +165,6 @@ func TestCombinedIterator_Next(t *testing.T) { expectedRecords := testRecords() - // interrupt repl connection - var terminated bool - is.NoErr(pool.QueryRow(ctx, fmt.Sprintf( - `SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE - query ILIKE '%%CREATE_REPLICATION_SLOT %s%%' and pid <> pg_backend_pid() - `, - table, - )).Scan(&terminated)) - is.True(terminated) - // compare snapshot for id := 1; id < 5; id++ { t.Run(fmt.Sprint("next_snapshot", id), func(t *testing.T) { @@ -194,6 +184,16 @@ func TestCombinedIterator_Next(t *testing.T) { }) } + // interrupt repl connection + var terminated bool + is.NoErr(pool.QueryRow(ctx, fmt.Sprintf( + `SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE + query ILIKE '%%CREATE_REPLICATION_SLOT %s%%' and pid <> pg_backend_pid() + `, + table, + )).Scan(&terminated)) + is.True(terminated) + t.Run("next_cdc_5", func(t *testing.T) { is := is.New(t)