Update test.py

This commit is contained in:
Kseniia Sumarokova 2021-06-21 19:07:17 +03:00 committed by GitHub
parent ac0f86cdbf
commit f47dd116c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -276,28 +276,28 @@ def test_put_get_with_redirect(started_cluster):
# Test put with restricted S3 server redirect. # Test put with restricted S3 server redirect.
def test_put_with_zero_redirect(started_cluster): def test_put_with_zero_redirect(started_cluster):
# type: (clickhousecluster) -> none # type: (ClickHouseCluster) -> None
bucket = started_cluster.minio_bucket bucket = started_cluster.minio_bucket
instance = started_cluster.instances["s3_max_redirects"] # type: clickhouseinstance instance = started_cluster.instances["s3_max_redirects"] # type: ClickHouseInstance
table_format = "column1 uint32, column2 uint32, column3 uint32" table_format = "column1 UInt32, column2 UInt32, column3 UInt32"
values = "(1, 1, 1), (1, 1, 1), (11, 11, 11)" values = "(1, 1, 1), (1, 1, 1), (11, 11, 11)"
filename = "test.csv" filename = "test.csv"
# should work without redirect # Should work without redirect
query = "insert into table function s3('http://{}:{}/{}/{}', 'csv', '{}') values {}".format( query = "insert into table function s3('http://{}:{}/{}/{}', 'CSV', '{}') values {}".format(
started_cluster.minio_ip, minio_internal_port, bucket, filename, table_format, values) started_cluster.minio_ip, MINIO_INTERNAL_PORT, bucket, filename, table_format, values)
run_query(instance, query) run_query(instance, query)
# should not work with redirect # Should not work with redirect
query = "insert into table function s3('http://{}:{}/{}/{}', 'csv', '{}') values {}".format( query = "insert into table function s3('http://{}:{}/{}/{}', 'CSV', '{}') values {}".format(
started_cluster.minio_redirect_host, started_cluster.minio_redirect_port, bucket, filename, table_format, values) started_cluster.minio_redirect_host, started_cluster.minio_redirect_port, bucket, filename, table_format, values)
exception_raised = false exception_raised = False
try: try:
run_query(instance, query) run_query(instance, query)
except exception as e: except Exception as e:
assert str(e).find("too many redirects while trying to access") != -1 assert str(e).find("Too many redirects while trying to access") != -1
exception_raised = true exception_raised = True
finally: finally:
assert exception_raised assert exception_raised