From 591c556321345137979fda1ecd7b492c65a62747 Mon Sep 17 00:00:00 2001 From: Vladimir Chebotarev Date: Sun, 9 May 2021 00:55:24 +0300 Subject: [PATCH] Improved `test_storage_s3_get_unstable`. --- .../test_storage_s3/s3_mocks/unstable_server.py | 7 ++++++- tests/integration/test_storage_s3/test.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_storage_s3/s3_mocks/unstable_server.py b/tests/integration/test_storage_s3/s3_mocks/unstable_server.py index 03e0d8fa288..0c188a454a6 100644 --- a/tests/integration/test_storage_s3/s3_mocks/unstable_server.py +++ b/tests/integration/test_storage_s3/s3_mocks/unstable_server.py @@ -11,7 +11,11 @@ def gen_n_digit_number(n): return random.randint(10**(n-1), 10**n-1) +sum_4 = 0 + + def gen_line(): + global sum_4 columns = 4 row = [] @@ -24,13 +28,14 @@ def gen_line(): row.append(1) for i in range(columns - 1 - columns // 2): add_number() + sum_4 += row[-1] line = ",".join(map(str, row)) + "\n" return line.encode() random.seed("Unstable server/1.0") -lines = b"".join((gen_line() for _ in range(500000))) +lines = b"".join((gen_line() for _ in range(500000))) + f"0,0,0,{-sum_4}\n".encode() class RequestHandler(http.server.BaseHTTPRequestHandler): diff --git a/tests/integration/test_storage_s3/test.py b/tests/integration/test_storage_s3/test.py index 69b0bfe205a..545ca4256f3 100644 --- a/tests/integration/test_storage_s3/test.py +++ b/tests/integration/test_storage_s3/test.py @@ -568,9 +568,9 @@ def test_storage_s3_get_unstable(started_cluster): bucket = started_cluster.minio_bucket instance = started_cluster.instances["dummy"] table_format = "column1 Int64, column2 Int64, column3 Int64, column4 Int64" - get_query = f"SELECT count(), sum(column3) FROM s3('http://resolver:8081/{started_cluster.minio_bucket}/test.csv', 'CSV', '{table_format}') FORMAT CSV" + get_query = f"SELECT count(), sum(column3), sum(column4) FROM s3('http://resolver:8081/{started_cluster.minio_bucket}/test.csv', 'CSV', '{table_format}') FORMAT CSV" result = run_query(instance, get_query) - assert result.splitlines() == ["500000,500000"] + assert result.splitlines() == ["500001,500000,0"] def test_storage_s3_put_uncompressed(started_cluster):