aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexbogo <alexbogo@ydb.tech>2023-07-31 16:21:38 +0300
committeralexbogo <alexbogo@ydb.tech>2023-07-31 16:21:38 +0300
commit595034cc33a4dc2d0d2057bd0c9e36342b52184f (patch)
tree256a1ae4691635f72743033354a14f32afe7f866
parent68cf571393094f43bac88208cbefc56ef042dc10 (diff)
downloadydb-595034cc33a4dc2d0d2057bd0c9e36342b52184f.tar.gz
[ymq] fix python style in tests & remove unused code
init
-rw-r--r--ydb/tests/library/sqs/requests_client.py21
-rw-r--r--ydb/tests/library/sqs/tables.py26
-rw-r--r--ydb/tests/library/sqs/test_base.py7
3 files changed, 19 insertions, 35 deletions
diff --git a/ydb/tests/library/sqs/requests_client.py b/ydb/tests/library/sqs/requests_client.py
index 437957d16f8..000e88b3ae0 100644
--- a/ydb/tests/library/sqs/requests_client.py
+++ b/ydb/tests/library/sqs/requests_client.py
@@ -45,6 +45,7 @@ def auth_headers(user, security_token=None, iam_token=None):
return headers
+
SQS_ATTRIBUTE_TYPES = {'String': 'StringValue', 'Number': 'StringValue', 'Binary': 'BinaryValue'}
@@ -97,7 +98,7 @@ class SqsHttpApi(object):
self.__user = user
self.__timeout = timeout
self.__security_token = security_token
- assert(isinstance(force_private, bool))
+ assert isinstance(force_private, bool)
self.__force_private = force_private
self.__folder_id = folder_id
@@ -560,21 +561,3 @@ class SqsHttpApi(object):
assert i < len(result) and i >= 0
result[i]['BatchResultErrorEntry'] = err
return result
-
-
-class SqsHttpMinigunApi(SqsHttpApi):
- def _process_response(self, response, extract_method, default=None):
- if response is None:
- return -1, default
- try:
- parsed = xmltodict.parse(response.text)
- except xmltodict.expat.ExpatError:
- return response.status_code, default
-
- if response.status_code != 200:
- extract_method = lambda x: x['ErrorResponse']['Error']['Message']
- try:
- result = extract_method(parsed)
- except (KeyError, TypeError):
- result = default
- return response.status_code, result
diff --git a/ydb/tests/library/sqs/tables.py b/ydb/tests/library/sqs/tables.py
index 4c17299c755..ccd261f2cfe 100644
--- a/ydb/tests/library/sqs/tables.py
+++ b/ydb/tests/library/sqs/tables.py
@@ -25,26 +25,26 @@ def _create_table(root, session, table_name, columns, keys_count, common_table=T
keys = [name for name, _ in columns[:keys_count]]
columns = [ydb.Column(name, ydb.OptionalType(column_type)) for name, column_type in columns]
+ description = ydb.TableDescription()
+ description.with_primary_keys(*keys)
+ description.with_columns(*columns)
if queue_type and common_table:
+ partitions = ydb.PartitioningSettings()
+ partitions.with_min_partitions_count(10)
+ partitions.with_partitioning_by_size(ydb.FeatureFlag.ENABLED)
+ partitions.with_partitioning_by_load(ydb.FeatureFlag.ENABLED)
+
+ description.with_uniform_partitions(10)
+ description.with_partitioning_settings(partitions)
+
ydb.retry_operation_sync(lambda: session.create_table(
table_path,
- ydb.TableDescription()
- .with_primary_keys(*keys)
- .with_columns(*columns)
- .with_uniform_partitions(10)
- .with_partitioning_settings(
- ydb.PartitioningSettings()
- .with_min_partitions_count(10)
- .with_partitioning_by_size(ydb.FeatureFlag.ENABLED)
- .with_partitioning_by_load(ydb.FeatureFlag.ENABLED)
- )
+ description
))
else:
ydb.retry_operation_sync(lambda: session.create_table(
table_path,
- ydb.TableDescription()
- .with_primary_keys(*keys)
- .with_columns(*columns)
+ description
))
diff --git a/ydb/tests/library/sqs/test_base.py b/ydb/tests/library/sqs/test_base.py
index 1079514b90d..ad1d054ff24 100644
--- a/ydb/tests/library/sqs/test_base.py
+++ b/ydb/tests/library/sqs/test_base.py
@@ -272,7 +272,8 @@ class KikimrSqsTestBase(object):
raised = False
try:
self._driver.scheme_client.describe_path('{}/{}/Queues'.format(self.sqs_root, username))
- except:
+ except Exception as e:
+ logger.debug(f'No queue table: {e}')
raised = True # Expect SchemeError or at least ConnectionLost in tests with node killings
assert_that(raised)
@@ -556,7 +557,7 @@ class KikimrSqsTestBase(object):
else:
if self.cluster.nodes[i + 1].is_alive():
return i
- assert(False)
+ assert False, 'alive node not found'
def _get_mon_port(self, node_index):
if self.slot_count:
@@ -581,7 +582,7 @@ class KikimrSqsTestBase(object):
raise Exception('Unknown counters format: \"{}\"'.format(counters_format))
if folder is not None:
- labels="/cloud%3D{cloud}/folder%3D{folder}".format(cloud=cloud, folder=folder)
+ labels = "/cloud%3D{cloud}/folder%3D{folder}".format(cloud=cloud, folder=folder)
else:
labels = ''
counters_url = 'http://localhost:{port}/counters/counters%3D{component}{labels}{suffix}'.format(