From c85fd74d34a76dfe986f549436c21d92238b5fde Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Mon, 8 Apr 2024 17:37:48 +0300 Subject: [PATCH] Fix test_physical_replication test taken in acount autocommit behaviour of psycopg --- .../regress/test_physical_replication.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test_runner/regress/test_physical_replication.py b/test_runner/regress/test_physical_replication.py index 034f2b669d..7b5c79d469 100644 --- a/test_runner/regress/test_physical_replication.py +++ b/test_runner/regress/test_physical_replication.py @@ -18,12 +18,15 @@ def test_physical_replication(neon_simple_env: NeonEnv): ) time.sleep(1) with env.endpoints.new_replica_start(origin=primary, endpoint_id="secondary") as secondary: - with primary.connect() as p_con: - with p_con.cursor() as p_cur: - with secondary.connect() as s_con: - with s_con.cursor() as s_cur: - for pk in range(n_records): - p_cur.execute("insert into t (pk) values (%s)", (pk,)) - s_cur.execute( - "select * from t where pk=%s", (random.randrange(1, n_records),) - ) + p_con = primary.connect() + s_con = secondary.connect() + count = 0 + with p_con.cursor() as p_cur: + with s_con.cursor() as s_cur: + for pk in range(n_records): + p_cur.execute("insert into t (pk) values (%s)", (pk,)) + s_cur.execute( + "select count(*) from t where pk=%s", (random.randrange(1, n_records),) + ) + count += s_cur.fetchall()[0][0] + assert count > 0