Skip to content

Commit 9e60c00

Browse files
authored
Prepare test to migration (#12473)
Co-authored-by: Dmitry Nechitaev <nechda@yandex-team.ru>
1 parent 4b65210 commit 9e60c00

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

ydb/tests/fq/s3/test_insert.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
import ydb.tests.fq.s3.s3_helpers as s3_helpers
1414
from ydb.tests.tools.fq_runner.kikimr_utils import yq_v1, yq_all
1515

16+
from moto import __version__ as moto_version
17+
from packaging.version import Version
18+
1619

1720
class TestS3(object):
1821
def create_bucket_and_upload_file(self, filename, s3, kikimr):
@@ -435,7 +438,8 @@ def test_error(self, kikimr, s3, client, format, unique_prefix):
435438
)
436439

437440
bucket = resource.Bucket("error_bucket")
438-
bucket.create(ACL='')
441+
acl = '' if Version(moto_version) < Version("4.0.5") else 'public-write'
442+
bucket.create(ACL=acl)
439443
bucket.objects.all().delete()
440444

441445
kikimr.control_plane.wait_bootstrap(1)
@@ -462,18 +466,26 @@ def test_error(self, kikimr, s3, client, format, unique_prefix):
462466
)
463467

464468
query_id = client.create_query("simple", sql, type=fq.QueryContent.QueryType.ANALYTICS).result.query_id
465-
start_at = time.time()
466-
while True:
467-
result = client.describe_query(query_id).result
468-
assert result.query.meta.status in [
469-
fq.QueryMeta.STARTING,
470-
fq.QueryMeta.RUNNING,
471-
], "Query is not RUNNING anymore"
472-
issues = result.query.transient_issue
473-
if "500 Internal Server Error" in str(issues):
474-
break
475-
assert time.time() - start_at < 20, "Timeout waiting for transient issue in " + str(issues)
476-
time.sleep(0.5)
469+
if Version(moto_version) < Version("4.0.5"):
470+
start_at = time.time()
471+
while True:
472+
result = client.describe_query(query_id).result
473+
assert result.query.meta.status in [
474+
fq.QueryMeta.STARTING,
475+
fq.QueryMeta.RUNNING,
476+
], "Query is not RUNNING anymore"
477+
issues = result.query.transient_issue
478+
if "500 Internal Server Error" in str(issues):
479+
break
480+
assert time.time() - start_at < 20, "Timeout waiting for transient issue in " + str(issues)
481+
time.sleep(0.5)
482+
else:
483+
# Available since moto version 4.0.5+
484+
client.wait_query_status(query_id, fq.QueryMeta.FAILED)
485+
msg = client.describe_query(query_id).result.query.issue
486+
assert 'HTTP error code: 403' in str(msg)
487+
assert 'Query failed with code EXTERNAL_ERROR' in str(msg)
488+
477489
client.abort_query(query_id)
478490
client.wait_query(query_id)
479491

ydb/tests/fq/s3/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ INCLUDE(${ARCADIA_ROOT}/ydb/tests/tools/fq_runner/ydb_runner_with_datastreams.in
66

77
PEERDIR(
88
contrib/python/boto3
9+
contrib/python/moto
910
contrib/python/pyarrow
1011
library/python/testing/recipe
1112
library/python/testing/yatest_common

0 commit comments

Comments
 (0)