diff --git a/tests/integration/test_insert_into_distributed/test.py b/tests/integration/test_insert_into_distributed/test.py index d54336a3027..47200df4a85 100644 --- a/tests/integration/test_insert_into_distributed/test.py +++ b/tests/integration/test_insert_into_distributed/test.py @@ -198,28 +198,34 @@ def test_inserts_single_replica_local_internal_replication(started_cluster): def test_inserts_single_replica_internal_replication(started_cluster): - node1.query( - "INSERT INTO distributed_one_replica_internal_replication VALUES ('2000-01-01', 1)", - settings={ - "insert_distributed_sync": "1", - "prefer_localhost_replica": "0", - # to make the test more deterministic - "load_balancing": "first_or_random", - }, - ) - assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1' - - -def test_inserts_single_replica_no_internal_replication(started_cluster): - with pytest.raises(QueryRuntimeException, match="Table default.single_replicated doesn't exist"): + try: node1.query( - "INSERT INTO distributed_one_replica_no_internal_replication VALUES ('2000-01-01', 1)", + "INSERT INTO distributed_one_replica_internal_replication VALUES ('2000-01-01', 1)", settings={ "insert_distributed_sync": "1", "prefer_localhost_replica": "0", + # to make the test more deterministic + "load_balancing": "first_or_random", }, ) - assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1' + assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1' + finally: + node2.query("TRUNCATE TABLE single_replicated") + + +def test_inserts_single_replica_no_internal_replication(started_cluster): + try: + with pytest.raises(QueryRuntimeException, match="Table default.single_replicated doesn't exist"): + node1.query( + "INSERT INTO distributed_one_replica_no_internal_replication VALUES ('2000-01-01', 1)", + settings={ + "insert_distributed_sync": "1", + "prefer_localhost_replica": "0", + }, + ) + assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1' + finally: + node2.query("TRUNCATE TABLE single_replicated") def test_prefer_localhost_replica(started_cluster):