Skip to content

Commit 62f1c0c

Browse files
authored
Merge pull request ClickHouse#78744 from ClickHouse/ncb/fix-s3q-test-registry
fix flaky test `test_storage_s3_queue/test_4.py`
2 parents 391ac84 + 27a3a63 commit 62f1c0c

File tree

1 file changed

+8
-12
lines changed
  • tests/integration/test_storage_s3_queue

1 file changed

+8
-12
lines changed

tests/integration/test_storage_s3_queue/test_4.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
import io
2-
import json
31
import logging
4-
import random
5-
import string
62
import time
73
import uuid
84
from multiprocessing.dummy import Pool
95

106
import pytest
11-
from kazoo.exceptions import NoNodeError
127

13-
from helpers.client import QueryRuntimeException
148
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
159
from helpers.s3_queue_common import (
1610
run_query,
@@ -140,7 +134,7 @@ def test_replicated(started_cluster):
140134
f"SELECT * FROM system.zookeeper WHERE path = '{keeper_path}'"
141135
)
142136

143-
total_values = generate_random_files(
137+
generate_random_files(
144138
started_cluster, files_path, files_to_generate, start_ind=0, row_num=1
145139
)
146140

@@ -170,10 +164,8 @@ def test_bad_settings(started_cluster):
170164
node = started_cluster.instances["node_cloud_mode"]
171165

172166
table_name = f"test_bad_settings_{uuid.uuid4().hex[:8]}"
173-
dst_table_name = f"{table_name}_dst"
174167
keeper_path = f"/clickhouse/test_{table_name}"
175168
files_path = f"{table_name}_data"
176-
files_to_generate = 10
177169

178170
try:
179171
create_table(
@@ -225,7 +217,7 @@ def test_processing_threads(started_cluster):
225217
)
226218
)
227219

228-
total_values = generate_random_files(
220+
generate_random_files(
229221
started_cluster, files_path, files_to_generate, start_ind=0, row_num=1
230222
)
231223

@@ -296,7 +288,7 @@ def test_alter_settings(started_cluster):
296288
f"SELECT * FROM system.zookeeper WHERE path = '{keeper_path}'"
297289
)
298290

299-
total_values = generate_random_files(
291+
generate_random_files(
300292
started_cluster, files_path, files_to_generate, start_ind=0, row_num=1
301293
)
302294

@@ -588,7 +580,7 @@ def test_registry(started_cluster):
588580
for elem in expected:
589581
assert elem in str(registry)
590582

591-
total_values = generate_random_files(
583+
generate_random_files(
592584
started_cluster, files_path, files_to_generate, start_ind=0, row_num=1
593585
)
594586

@@ -624,6 +616,10 @@ def get_count():
624616
database_name=db_name,
625617
)
626618

619+
# ensure that the table is created on node2 before we query the registry as there might be a race between the time
620+
# we actually create the table on node2 and when we query the registry.
621+
node2.query(f"SYSTEM SYNC DATABASE REPLICA {db_name}")
622+
627623
registry, stat = zk.get(f"{keeper_path}/registry/")
628624

629625
uuid2 = node1.query(

0 commit comments

Comments
 (0)