Improved test_storage_s3_get_unstable.

This commit is contained in:
Vladimir Chebotarev 2021-05-09 00:55:24 +03:00
parent f42fbe7eab
commit 591c556321
2 changed files with 8 additions and 3 deletions

View File

@ -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):

View File

@ -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):