Skip to content

Commit ac710ff

Browse files
Merge pull request ClickHouse#17299 from Jokser/flaky-s3-test-custom-auth-headers
Fixed flaky test_storage_s3::test_custom_auth_headers
2 parents e76f7c3 + 5f98d38 commit ac710ff

File tree

1 file changed

+13
-4
lines changed
  • tests/integration/test_storage_s3

1 file changed

+13
-4
lines changed

tests/integration/test_storage_s3/test.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,23 @@ def run_s3_mock(cluster):
351351
current_dir = os.path.dirname(__file__)
352352
cluster.copy_file_to_container(container_id, os.path.join(current_dir, "s3_mock", "mock_s3.py"), "mock_s3.py")
353353
cluster.exec_in_container(container_id, ["python", "mock_s3.py"], detach=True)
354+
355+
# Wait for S3 mock start
356+
for attempt in range(10):
357+
ping_response = cluster.exec_in_container(cluster.get_container_id('resolver'),
358+
["curl", "-s", "http://resolver:8080/"], nothrow=True)
359+
if ping_response != 'OK':
360+
if attempt == 9:
361+
assert ping_response == 'OK', 'Expected "OK", but got "{}"'.format(ping_response)
362+
else:
363+
time.sleep(1)
364+
else:
365+
break
366+
354367
logging.info("S3 mock started")
355368

356369

357370
def test_custom_auth_headers(cluster):
358-
ping_response = cluster.exec_in_container(cluster.get_container_id('resolver'),
359-
["curl", "-s", "http://resolver:8080"])
360-
assert ping_response == 'OK', 'Expected "OK", but got "{}"'.format(ping_response)
361-
362371
table_format = "column1 UInt32, column2 UInt32, column3 UInt32"
363372
filename = "test.csv"
364373
get_query = "select * from s3('http://resolver:8080/{bucket}/{file}', 'CSV', '{table_format}')".format(

0 commit comments

Comments
 (0)