From f4bfa0fea3ab02401df49b676f2f1f92c0a60f82 Mon Sep 17 00:00:00 2001 From: Kseniia Sumarokova <54203879+kssenii@users.noreply.github.com> Date: Tue, 5 Apr 2022 19:01:41 +0200 Subject: [PATCH] Update test.py --- .../test_storage_postgresql_replica/test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_storage_postgresql_replica/test.py b/tests/integration/test_storage_postgresql_replica/test.py index fe8b92ea606..8cc4b2049a2 100644 --- a/tests/integration/test_storage_postgresql_replica/test.py +++ b/tests/integration/test_storage_postgresql_replica/test.py @@ -106,7 +106,7 @@ def create_clickhouse_postgres_db(ip, port, name="postgres_database"): def create_materialized_table(ip, port, table_name='postgresql_replica'): instance.query( f""" - CREATE TABLE test.{table_name} (key UInt64, value UInt64) + CREATE TABLE test.{table_name} (key Int64, value Int64) ENGINE = MaterializedPostgreSQL( '{ip}:{port}', 'postgres_database', '{table_name}', 'postgres', 'mysecretpassword') PRIMARY KEY key; """ @@ -703,11 +703,21 @@ def test_abrupt_server_restart_while_heavy_replication(started_cluster): table_name = "postgresql_replica_697" create_postgres_table(cursor, table_name) + instance.query( + f"INSERT INTO postgres_database.{table_name} SELECT -1, 1" + ) instance.query(f"DROP TABLE IF EXISTS test.{table_name}") create_materialized_table( ip=started_cluster.postgres_ip, port=started_cluster.postgres_port, table_name=table_name ) + n = 1 + while int(instance.query(f"select count() from test.{table_name}")) != 1: + sleep(1) + n += 1 + if n > 10: + break; + for query in queries: cursor.execute(query.format(table_name)) print("query {}".format(query.format(table_name)))