diff options
author | Alexey Bogolyubskiy <i@bogolyubskiyalexey.ru> | 2022-05-25 17:41:04 +0300 |
---|---|---|
committer | Alexey Bogolyubskiy <i@bogolyubskiyalexey.ru> | 2022-05-25 17:41:04 +0300 |
commit | 56fca0cd82a821d8e3574141b7a2bb2d80477e9d (patch) | |
tree | 903b538fe9d430b0f9d5d54ce3bae976edae7a5f | |
parent | 5352bcdbc3e1d002cc3df3a0c2331de97940f6b7 (diff) | |
download | ydb-56fca0cd82a821d8e3574141b7a2bb2d80477e9d.tar.gz |
sqs: switch tests to both tables format & fix purge query
init
ref:b613ebc4ada5efed834c2ce60e900b81e97563af
-rw-r--r-- | ydb/core/ymq/actor/purge_queue.cpp | 10 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/__init__.py (renamed from ydb/tests/functional/sqs/__init__.py) | 0 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_account_actions.py (renamed from ydb/tests/functional/sqs/test_account_actions.py) | 2 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_acl.py (renamed from ydb/tests/functional/sqs/test_acl.py) | 15 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_counters.py (renamed from ydb/tests/functional/sqs/test_counters.py) | 4 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_garbage_collection.py (renamed from ydb/tests/functional/sqs/test_garbage_collection.py) | 8 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_multiplexing_tables_format.py (renamed from ydb/tests/functional/sqs/test_multiplexing_tables_format.py) | 4 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_ping.py (renamed from ydb/tests/functional/sqs/test_ping.py) | 2 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_queue_attributes_validation.py (renamed from ydb/tests/functional/sqs/test_queue_attributes_validation.py) | 28 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/common/test_queues_managing.py (renamed from ydb/tests/functional/sqs/test_queues_managing.py) | 26 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/messaging/__init__.py | 4 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/messaging/test_fifo_messaging.py (renamed from ydb/tests/functional/sqs/test_fifo_messaging.py) | 4 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/messaging/test_generic_messaging.py (renamed from ydb/tests/functional/sqs/test_generic_messaging.py) | 211 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/messaging/test_polling.py (renamed from ydb/tests/functional/sqs/test_polling.py) | 11 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/multinode/__init__.py | 4 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/multinode/test_multinode_cluster.py (renamed from ydb/tests/functional/sqs/test_multinode_cluster.py) | 4 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/multinode/test_recompiles_requests.py (renamed from ydb/tests/functional/sqs/test_recompiles_requests.py) | 2 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/with_quotas/__init__.py | 4 | ||||
-rw-r--r-- | ydb/tests/functional/sqs/with_quotas/test_quoting.py (renamed from ydb/tests/functional/sqs/test_quoting.py) | 4 | ||||
-rw-r--r-- | ydb/tests/library/sqs/matchers.py (renamed from ydb/tests/functional/sqs/sqs_matchers.py) | 0 | ||||
-rw-r--r-- | ydb/tests/library/sqs/requests_client.py (renamed from ydb/tests/functional/sqs/sqs_requests_client.py) | 0 | ||||
-rw-r--r-- | ydb/tests/library/sqs/test_base.py (renamed from ydb/tests/functional/sqs/sqs_test_base.py) | 19 |
22 files changed, 230 insertions, 136 deletions
diff --git a/ydb/core/ymq/actor/purge_queue.cpp b/ydb/core/ymq/actor/purge_queue.cpp index 72830bdd4a7..959273ef7c4 100644 --- a/ydb/core/ymq/actor/purge_queue.cpp +++ b/ydb/core/ymq/actor/purge_queue.cpp @@ -6,6 +6,8 @@ #include "params.h" #include "serviceid.h" +#include <ydb/core/ymq/queues/common/key_hashes.h> + #include <util/string/join.h> using NKikimr::NClient::TValue; @@ -50,6 +52,8 @@ private: .Counters(QueueCounters_) .RetryOnTimeout() .Params() + .Uint64("QUEUE_ID_NUMBER", QueueVersion_.GetRef()) + .Uint64("QUEUE_ID_NUMBER_HASH", GetKeysHash(QueueVersion_.GetRef())) .Uint64("NOW", Now().MilliSeconds()) .Bool("PURGE", true) .ParentBuilder().Start(); @@ -79,7 +83,11 @@ private: auto req = MakeHolder<TSqsEvents::TEvPurgeQueue>(); req->QueuePath = GetQueuePath(); req->Boundary = TInstant::MilliSeconds(ui64(list[i]["RetentionBoundary"])); - req->Shard = ui64(list[i]["Shard"]); + if (TablesFormat() == 0) { + req->Shard = ui64(list[i]["Shard"]); + } else { + req->Shard = ui32(list[i]["Shard"]); + } RLOG_SQS_INFO("Purging queue. Set retention boundary for queue [" << req->QueuePath << "/" << req->Shard << "] to " << req->Boundary.MilliSeconds() << " (" << req->Boundary << ")"); diff --git a/ydb/tests/functional/sqs/__init__.py b/ydb/tests/functional/sqs/common/__init__.py index 6ca2b961344..6ca2b961344 100644 --- a/ydb/tests/functional/sqs/__init__.py +++ b/ydb/tests/functional/sqs/common/__init__.py diff --git a/ydb/tests/functional/sqs/test_account_actions.py b/ydb/tests/functional/sqs/common/test_account_actions.py index 60ab1e4d102..74e1a4595d7 100644 --- a/ydb/tests/functional/sqs/test_account_actions.py +++ b/ydb/tests/functional/sqs/common/test_account_actions.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- from hamcrest import assert_that, not_none, has_item, is_not -from sqs_test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation class AccountActionsTest(KikimrSqsTestBase): diff --git a/ydb/tests/functional/sqs/test_acl.py b/ydb/tests/functional/sqs/common/test_acl.py index 83299f09f71..76ea8abffa0 100644 --- a/ydb/tests/functional/sqs/test_acl.py +++ b/ydb/tests/functional/sqs/common/test_acl.py @@ -8,7 +8,8 @@ from hamcrest import assert_that, none, is_not, is_, raises import ydb.tests.library.common.yatest_common as yatest_common -from sqs_test_base import KikimrSqsTestBase, get_sqs_client_path, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, get_sqs_client_path, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation +from ydb.tests.library.sqs.test_base import TABLES_FORMAT_PARAMS class SqsACLTest(KikimrSqsTestBase): @@ -76,7 +77,9 @@ class SqsACLTest(KikimrSqsTestBase): return list(permissions) - def test_modify_permissions(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_modify_permissions(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name, False, True) self._send_message_and_assert(queue_url, 'data') @@ -118,7 +121,9 @@ class SqsACLTest(KikimrSqsTestBase): assert self._extract_permissions_for(alkonavt_sid, description) == [] assert self._extract_permissions_for(berkanavt_sid, description) == [] - def test_apply_permissions(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_apply_permissions(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name, False, True) self._send_message_and_assert(queue_url, 'data') @@ -181,7 +186,9 @@ class SqsWithForceAuthorizationTest(KikimrSqsTestBase): @pytest.mark.parametrize(argnames='token,pattern', argvalues=[('invalid_token', 'AccessDeniedException'), ('', 'No security token was provided.'), (None, 'InvalidClientTokenId')], ids=['invalid', 'empty', 'no']) - def test_invalid_token(self, token, pattern): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_invalid_token(self, token, pattern, tables_format): + self._init_with_params(tables_format=tables_format) sqs_api = self._create_api_for_user(self._username, raise_on_error=True, security_token=token) def call_list(): diff --git a/ydb/tests/functional/sqs/test_counters.py b/ydb/tests/functional/sqs/common/test_counters.py index dc23814a6b1..80149eac966 100644 --- a/ydb/tests/functional/sqs/test_counters.py +++ b/ydb/tests/functional/sqs/common/test_counters.py @@ -6,7 +6,7 @@ import time import pytest from hamcrest import assert_that, equal_to, none, not_, greater_than, raises -from sqs_test_base import KikimrSqsTestBase +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase class TestSqsCountersFeatures(KikimrSqsTestBase): @@ -197,8 +197,8 @@ class TestSqsCountersFeatures(KikimrSqsTestBase): time.sleep(0.2) continue - assert_that(user_counter, not_(none())) if not switch_user: + assert_that(user_counter, not_(none())) assert_that(queue_counter, not_(none())) break diff --git a/ydb/tests/functional/sqs/test_garbage_collection.py b/ydb/tests/functional/sqs/common/test_garbage_collection.py index aff51e3bcd2..af6d633ffa8 100644 --- a/ydb/tests/functional/sqs/test_garbage_collection.py +++ b/ydb/tests/functional/sqs/common/test_garbage_collection.py @@ -8,12 +8,12 @@ import random import pytest from hamcrest import assert_that, equal_to, less_than_or_equal_to -from sqs_requests_client import SqsHttpApi +from ydb.tests.library.sqs.requests_client import SqsHttpApi -from sqs_matchers import ReadResponseMatcher +from ydb.tests.library.sqs.matchers import ReadResponseMatcher -from sqs_test_base import to_bytes -from sqs_test_base import KikimrSqsTestBase, VISIBILITY_CHANGE_METHOD_PARAMS, IS_FIFO_PARAMS, TABLES_FORMAT_PARAMS +from ydb.tests.library.sqs.test_base import to_bytes +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, VISIBILITY_CHANGE_METHOD_PARAMS, IS_FIFO_PARAMS, TABLES_FORMAT_PARAMS def send_message(server, username, queue_url, sqs_port, body, seq_no, group_id): diff --git a/ydb/tests/functional/sqs/test_multiplexing_tables_format.py b/ydb/tests/functional/sqs/common/test_multiplexing_tables_format.py index e98e0c8dd0e..05479f69a7e 100644 --- a/ydb/tests/functional/sqs/test_multiplexing_tables_format.py +++ b/ydb/tests/functional/sqs/common/test_multiplexing_tables_format.py @@ -4,9 +4,9 @@ import pytest import yatest -from sqs_test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation, IS_FIFO_PARAMS +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation, IS_FIFO_PARAMS -from sqs_matchers import ReadResponseMatcher +from ydb.tests.library.sqs.matchers import ReadResponseMatcher class MultiplexingTablesFormatTest(KikimrSqsTestBase): diff --git a/ydb/tests/functional/sqs/test_ping.py b/ydb/tests/functional/sqs/common/test_ping.py index 7ee604ce561..ef0feb32e7b 100644 --- a/ydb/tests/functional/sqs/test_ping.py +++ b/ydb/tests/functional/sqs/common/test_ping.py @@ -4,7 +4,7 @@ import requests from hamcrest import assert_that, equal_to -from sqs_test_base import KikimrSqsTestBase +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase class TestPing(KikimrSqsTestBase): diff --git a/ydb/tests/functional/sqs/test_queue_attributes_validation.py b/ydb/tests/functional/sqs/common/test_queue_attributes_validation.py index 27ec79c9ee7..e09dbbfd38d 100644 --- a/ydb/tests/functional/sqs/test_queue_attributes_validation.py +++ b/ydb/tests/functional/sqs/common/test_queue_attributes_validation.py @@ -3,7 +3,7 @@ import pytest from hamcrest import assert_that, equal_to -from sqs_test_base import KikimrSqsTestBase, IS_FIFO_PARAMS +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, IS_FIFO_PARAMS, TABLES_FORMAT_PARAMS class TestQueueAttributesInCompatibilityMode(KikimrSqsTestBase): @@ -14,9 +14,10 @@ class TestQueueAttributesInCompatibilityMode(KikimrSqsTestBase): return config_generator @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_set_queue_attributes_no_validation(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_set_queue_attributes_no_validation(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) + queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo, use_http=True, attributes={'MaximumMessageSize': '1000000'}) assert_that(self._sqs_api.get_queue_attributes(queue_url)['MaximumMessageSize'], equal_to(str(256 * 1024))) @@ -42,9 +43,10 @@ class TestQueueAttributesValidation(KikimrSqsTestBase): return config_generator @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_set_queue_attributes(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_set_queue_attributes(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) + queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo, use_http=True) attributes = self._sqs_api.get_queue_attributes(queue_url) @@ -121,9 +123,9 @@ class TestQueueAttributesValidation(KikimrSqsTestBase): assert_that(False) # expected InvalidAttributeName exception @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_create_queue_with_default_attributes(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_create_queue_with_default_attributes(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) # check default queue creation queue_url = self._sqs_api.create_queue(self.queue_name, is_fifo=is_fifo) @@ -145,9 +147,9 @@ class TestQueueAttributesValidation(KikimrSqsTestBase): assert_that(attributes[attr], equal_to(expected_attributes[attr])) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_create_queue_with_custom_attributes(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_create_queue_with_custom_attributes(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) custom_attributes = { 'DelaySeconds': '1', diff --git a/ydb/tests/functional/sqs/test_queues_managing.py b/ydb/tests/functional/sqs/common/test_queues_managing.py index 62bc631f029..75d265ed0eb 100644 --- a/ydb/tests/functional/sqs/test_queues_managing.py +++ b/ydb/tests/functional/sqs/common/test_queues_managing.py @@ -5,10 +5,10 @@ import time import pytest from hamcrest import assert_that, equal_to, greater_than, not_none, none, has_item, has_items, raises, empty, instance_of -from sqs_matchers import ReadResponseMatcher +from ydb.tests.library.sqs.matchers import ReadResponseMatcher -from sqs_test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation, IS_FIFO_PARAMS -from sqs_test_base import to_bytes +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation +from ydb.tests.library.sqs.test_base import to_bytes, IS_FIFO_PARAMS, TABLES_FORMAT_PARAMS from ydb import issues as ydb_issues @@ -20,10 +20,11 @@ class QueuesManagingTest(KikimrSqsTestBase): return config_generator @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_create_queue(self, is_fifo): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_create_queue(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) attributes = {} if is_fifo: - self.queue_name = self.queue_name + '.fifo' attributes['ContentBasedDeduplication'] = 'true' attributes['DelaySeconds'] = '506' attributes['MaximumMessageSize'] = '10003' @@ -95,8 +96,8 @@ class QueuesManagingTest(KikimrSqsTestBase): @pytest.mark.parametrize(**IS_FIFO_PARAMS) def test_delete_queue(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + self._init_with_params(is_fifo) + created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) self._sqs_api.list_queues() self._sqs_api.send_message(created_queue_url, 'body', group_id='group' if is_fifo else None, deduplication_id='123' if is_fifo else None) @@ -174,9 +175,10 @@ class QueuesManagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_purge_queue(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_purge_queue(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) + created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) if is_fifo: group_id = 'group' @@ -238,8 +240,8 @@ class QueuesManagingTest(KikimrSqsTestBase): @pytest.mark.parametrize(**IS_FIFO_PARAMS) def test_delete_and_create_queue(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + self._init_with_params(is_fifo) + created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo, use_http=True) self.seq_no += 1 self._send_message_and_assert(created_queue_url, self._msg_body_template.format(1), seq_no=self.seq_no if is_fifo else None, group_id='group' if is_fifo else None) diff --git a/ydb/tests/functional/sqs/messaging/__init__.py b/ydb/tests/functional/sqs/messaging/__init__.py new file mode 100644 index 00000000000..6ca2b961344 --- /dev/null +++ b/ydb/tests/functional/sqs/messaging/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +_author__ = 'komels@yandex-team.ru' diff --git a/ydb/tests/functional/sqs/test_fifo_messaging.py b/ydb/tests/functional/sqs/messaging/test_fifo_messaging.py index 6410b219663..5d22717c001 100644 --- a/ydb/tests/functional/sqs/test_fifo_messaging.py +++ b/ydb/tests/functional/sqs/messaging/test_fifo_messaging.py @@ -6,9 +6,9 @@ import time import pytest from hamcrest import assert_that, equal_to, not_none, greater_than, less_than_or_equal_to, has_items, raises -from sqs_matchers import ReadResponseMatcher, extract_message_ids +from ydb.tests.library.sqs.matchers import ReadResponseMatcher, extract_message_ids -from sqs_test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation, VISIBILITY_CHANGE_METHOD_PARAMS +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation, VISIBILITY_CHANGE_METHOD_PARAMS class SqsFifoMicroBatchTest(KikimrSqsTestBase): diff --git a/ydb/tests/functional/sqs/test_generic_messaging.py b/ydb/tests/functional/sqs/messaging/test_generic_messaging.py index 1b1838ce580..05a6db6b32c 100644 --- a/ydb/tests/functional/sqs/test_generic_messaging.py +++ b/ydb/tests/functional/sqs/messaging/test_generic_messaging.py @@ -7,25 +7,27 @@ import time import pytest from hamcrest import assert_that, equal_to, not_none, greater_than, has_item, has_items, raises, is_not, not_, empty, instance_of -from sqs_requests_client import SqsMessageAttribute, SqsSendMessageParams, SqsChangeMessageVisibilityParams +from ydb.tests.library.sqs.requests_client import SqsMessageAttribute, SqsSendMessageParams, SqsChangeMessageVisibilityParams -from sqs_matchers import ReadResponseMatcher, extract_message_ids -from sqs_test_base import to_bytes -from sqs_test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation, IS_FIFO_PARAMS +from ydb.tests.library.sqs.matchers import ReadResponseMatcher, extract_message_ids +from ydb.tests.library.sqs.test_base import to_bytes +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, get_test_with_sqs_installation_by_path, get_test_with_sqs_tenant_installation +from ydb.tests.library.sqs.test_base import IS_FIFO_PARAMS, TABLES_FORMAT_PARAMS class SqsGenericMessagingTest(KikimrSqsTestBase): @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_send_message(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_send_message(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) self.seq_no += 1 self._send_message_and_assert(created_queue_url, 'test_send_message', seq_no=self.seq_no if is_fifo else None, group_id='group' if is_fifo else None) + if tables_format != 0: + return # break a queue and check failure self._break_queue(self._username, self.queue_name, is_fifo) - def call_send(): group = 'trololo' if is_fifo else None dedup = group @@ -42,10 +44,11 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_send_message_batch(self, is_fifo): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_send_message_batch(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) queue_attributes = {} if is_fifo: - self.queue_name = self.queue_name + '.fifo' queue_attributes['ContentBasedDeduplication'] = 'true' created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo, use_http=True, attributes=queue_attributes) group_id = 'group' if is_fifo else None @@ -90,6 +93,8 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): visibility_timeout=1000) assert_that(len([] if msgs is None else msgs), equal_to(0)) + if tables_format != 0: + return # break a queue and check failure self._break_queue(self._username, self.queue_name, is_fifo) @@ -129,9 +134,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_send_and_read_message(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_send_and_read_message(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) body = '<' + self._msg_body_template.format('trololo') + '<' # to ensure that we have correct xml @@ -240,7 +245,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): assert_that(self._get_counter_value(counters, send_counter_labels, 0), equal_to(1)) assert_that(self._get_counter_value(counters, receive_counter_labels, 0), equal_to(1)) - def test_validates_message_attributes(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_validates_message_attributes(self, tables_format): + self._init_with_params(tables_format=tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name) def call_send(attributes): @@ -275,7 +282,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): } assert_invalid_attributes(attributes3) - def test_send_to_nonexistent_queue(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_send_to_nonexistent_queue(self, tables_format): + self._init_with_params(tables_format=tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name) def call_send(): @@ -291,7 +300,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) ) - def test_receive_with_very_big_visibility_timeout(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_receive_with_very_big_visibility_timeout(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name) def call_with_very_big_visibility_timeout(): @@ -303,9 +314,10 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_create_q_twice(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_create_q_twice(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) + created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) self.seq_no += 1 message_id = self._send_message_and_assert(created_queue_url, self._msg_body_template, seq_no=self.seq_no if is_fifo else None, group_id='group' if is_fifo else None) @@ -318,7 +330,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): visibility_timeout=1000, matcher=ReadResponseMatcher().with_message_ids([message_id, ]) ) - def test_send_and_read_multiple_messages(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_send_and_read_multiple_messages(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=False) first_message_id = self._send_message_and_assert( queue_url, self._msg_body_template.format('0') @@ -334,7 +348,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ).with_messages_data([self._msg_body_template.format('0'), self._msg_body_template.format('1')]) ) - def test_read_dont_stall(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_read_dont_stall(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=False) first_pack_size = 5 second_pack_size = 5 @@ -347,7 +363,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ).with_n_or_more_messages(first_pack_size + 1).with_these_or_more_message_ids(first_pack_ids) ) - def test_multi_read_dont_stall(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_multi_read_dont_stall(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name) pack_size = 7 total_packs = 3 @@ -371,7 +389,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) ) - def test_visibility_timeout_works(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_visibility_timeout_works(self, tables_format): + self._init_with_params(tables_format=tables_format) total_msg_count = 10 visibility_timeout = 5 @@ -400,7 +420,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): matcher=ReadResponseMatcher().with_message_ids(self.message_ids).with_messages_data(msg_data) ) - def test_visibility_timeout_expires_on_wait_timeout(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_visibility_timeout_expires_on_wait_timeout(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=False) message_ids = self._send_messages( queue_url, message_count=10, msg_body_template=self._msg_body_template @@ -415,9 +437,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_zero_visibility_timeout_works(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_zero_visibility_timeout_works(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=1, read_count=1, visibility_timeout=0, @@ -429,9 +451,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_change_visibility_works(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_change_visibility_works(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=1, read_count=1, visibility_timeout=1000, @@ -472,9 +494,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_change_visibility_batch_works(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_change_visibility_batch_works(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) self._create_queue_and_assert(self.queue_name, is_fifo) @@ -543,9 +565,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_change_visibility_to_zero_works(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_change_visibility_to_zero_works(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=1, read_count=1, visibility_timeout=1000, @@ -558,7 +580,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): matcher=ReadResponseMatcher().with_n_messages(1) ) - def test_change_message_visibility_with_very_big_timeout(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_change_message_visibility_with_very_big_timeout(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name) self._create_queue_send_x_messages_read_y_messages( @@ -584,9 +608,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): assert_that(result[0]['BatchResultErrorEntry']['Code'], equal_to('InvalidParameterValue')) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_does_not_change_visibility_not_in_flight(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_does_not_change_visibility_not_in_flight(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=1, read_count=1, visibility_timeout=1, @@ -611,9 +635,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_does_not_change_visibility_for_deleted_message(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_does_not_change_visibility_for_deleted_message(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=1, read_count=1, visibility_timeout=1000, @@ -632,7 +656,10 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): raises(RuntimeError, pattern='InvalidParameterValue') ) - def test_delete_message_works(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_delete_message_works(self, tables_format): + self._init_with_params(tables_format=tables_format) + self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=10, read_count=2, visibility_timeout=0, msg_body_template=self._msg_body_template @@ -661,6 +688,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): } assert_that(self._get_counter_value(counters, delete_counter_labels, 0), equal_to(1)) + if tables_format != 0: + return + # break a queue and check failure self._break_queue(self._username, self.queue_name, False) @@ -674,7 +704,10 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): raises(RuntimeError, pattern='InternalFailure') ) - def test_delete_message_batch_works(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_delete_message_batch_works(self, tables_format): + self._init_with_params(tables_format=tables_format) + self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=9, read_count=9, msg_body_template=self._msg_body_template @@ -738,9 +771,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): assert_that(self._get_counter_value(counters, delete_counter_labels, 0), equal_to(9)) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_delete_message_batch_deduplicates_receipt_handle(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_delete_message_batch_deduplicates_receipt_handle(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=1, read_count=1, @@ -773,7 +806,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): else: assert_that(messages_count_metric, equal_to(0)) - def test_can_read_new_written_data_on_visibility_timeout(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_can_read_new_written_data_on_visibility_timeout(self, tables_format): + self._init_with_params(tables_format=tables_format) visibility_timeout = 15 self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=7, read_count=4, visibility_timeout=visibility_timeout, @@ -800,7 +835,10 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) ) - def test_partial_delete_works(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_partial_delete_works(self, tables_format): + self._init_with_params(tables_format=tables_format) + self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=10, read_count=5, visibility_timeout=5, msg_body_template=self._msg_body_template @@ -817,7 +855,10 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): matcher=ReadResponseMatcher().with_message_ids(self.message_ids) ) - def test_wrong_delete_fails(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_wrong_delete_fails(self, tables_format): + self._init_with_params(tables_format=tables_format) + self._create_queue_send_x_messages_read_y_messages( self.queue_name, send_count=1, read_count=1, visibility_timeout=5, msg_body_template=self._msg_body_template @@ -844,9 +885,10 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_queue_attributes(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_queue_attributes(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) + queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) # assert empty response when no attribute names are provided @@ -887,7 +929,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): attributes = self._sqs_api.get_queue_attributes(queue_url) assert_that(attributes['ContentBasedDeduplication'], equal_to('true')) - def test_set_very_big_visibility_timeout(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_set_very_big_visibility_timeout(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name) def call_with_very_big_visibility_timeout(): @@ -898,7 +942,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): raises(RuntimeError, pattern='InvalidAttributeValue') ) - def test_wrong_attribute_name(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_wrong_attribute_name(self, tables_format): + self._init_with_params(tables_format=tables_format) queue_url = self._create_queue_and_assert(self.queue_name) def call_with_wrong_attribute_name(): @@ -910,9 +956,10 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_get_queue_attributes_only_runtime_attributes(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_get_queue_attributes_only_runtime_attributes(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) + queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) attributes = self._sqs_api.get_queue_attributes(queue_url, ['ApproximateNumberOfMessagesDelayed']) assert_that(int(attributes['ApproximateNumberOfMessagesDelayed']), equal_to(0)) @@ -922,9 +969,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): assert_that(int(attributes['ApproximateNumberOfMessagesDelayed']), equal_to(1)) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_get_queue_attributes_only_attributes_table(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_get_queue_attributes_only_attributes_table(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) attributes = self._sqs_api.get_queue_attributes(queue_url, ['MaximumMessageSize']) assert_that(int(attributes['MaximumMessageSize']), equal_to(256 * 1024)) @@ -960,7 +1007,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) ) - def test_create_queue_by_nonexistent_user_fails(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_create_queue_by_nonexistent_user_fails(self, tables_format): + self._init_with_params(tables_format=tables_format) api = self._create_api_for_user('unknown_user') try: api.create_queue('known_queue_name') @@ -969,7 +1018,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): # Check that exception pattern will not give us any internal information assert_that(str(ex).find('.cpp:'), equal_to(-1)) - def test_list_queues_of_nonexistent_user(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_list_queues_of_nonexistent_user(self, tables_format): + self._init_with_params(tables_format=tables_format) api = self._create_api_for_user('unknown_user') def call_list_queues(): @@ -980,7 +1031,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): raises(RuntimeError, pattern='OptInRequired') ) - def test_invalid_queue_url(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_invalid_queue_url(self, tables_format): + self._init_with_params(tables_format=tables_format) def call_with_invalid_queue_url(): self._sqs_api.get_queue_attributes('invalid_queue_url') @@ -989,7 +1042,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): raises(RuntimeError, pattern='InvalidParameterValue') ) - def test_empty_queue_url(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_empty_queue_url(self, tables_format): + self._init_with_params(tables_format=tables_format) def call_with_empty_queue_url(): self._sqs_api.send_message(queue_url='', message_body='body') @@ -999,9 +1054,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_delay_one_message(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_delay_one_message(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) self._send_message_and_assert(created_queue_url, 'test_delay_message', delay_seconds=900, seq_no='1' if is_fifo else None, group_id='group' if is_fifo else None) @@ -1016,9 +1071,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) @pytest.mark.parametrize(**IS_FIFO_PARAMS) - def test_delay_message_batch(self, is_fifo): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_delay_message_batch(self, is_fifo, tables_format): + self._init_with_params(is_fifo, tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo) def get_group_id(i): @@ -1046,7 +1101,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ]) ) - def test_validates_message_body(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_validates_message_body(self, tables_format): + self._init_with_params(tables_format=tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name) def call_send(): @@ -1062,7 +1119,9 @@ class SqsGenericMessagingTest(KikimrSqsTestBase): ) ) - def test_validates_message_attribute_value(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_validates_message_attribute_value(self, tables_format): + self._init_with_params(tables_format=tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name) def call_send(): @@ -1086,7 +1145,9 @@ class TestYandexAttributesPrefix(KikimrSqsTestBase): config_generator.yaml_config['sqs_config']['allow_yandex_attribute_prefix'] = True return config_generator - def test_allows_yandex_message_attribute_prefix(self): + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_allows_yandex_message_attribute_prefix(self, tables_format): + self._init_with_params(tables_format=tables_format) created_queue_url = self._create_queue_and_assert(self.queue_name) self._sqs_api.send_message( diff --git a/ydb/tests/functional/sqs/test_polling.py b/ydb/tests/functional/sqs/messaging/test_polling.py index dba0556e7d4..da432b7fa72 100644 --- a/ydb/tests/functional/sqs/test_polling.py +++ b/ydb/tests/functional/sqs/messaging/test_polling.py @@ -3,9 +3,9 @@ import pytest from hamcrest import assert_that, equal_to -from sqs_matchers import ReadResponseMatcher +from ydb.tests.library.sqs.matchers import ReadResponseMatcher -from sqs_test_base import KikimrSqsTestBase, POLLING_PARAMS, IS_FIFO_PARAMS +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, POLLING_PARAMS, IS_FIFO_PARAMS, TABLES_FORMAT_PARAMS class TestSqsPolling(KikimrSqsTestBase): @@ -17,9 +17,10 @@ class TestSqsPolling(KikimrSqsTestBase): @pytest.mark.parametrize(**IS_FIFO_PARAMS) @pytest.mark.parametrize(**POLLING_PARAMS) - def test_receive_message_with_polling(self, is_fifo, polling_wait_timeout): - if is_fifo: - self.queue_name = self.queue_name + '.fifo' + @pytest.mark.parametrize(**TABLES_FORMAT_PARAMS) + def test_receive_message_with_polling(self, is_fifo, polling_wait_timeout, tables_format): + self._init_with_params(is_fifo, tables_format) + created_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo, use_http=False, shards=None if is_fifo else 1) empty_queue_url = self._create_queue_and_assert(self.queue_name, is_fifo=is_fifo, use_http=False, shards=None if is_fifo else 1) diff --git a/ydb/tests/functional/sqs/multinode/__init__.py b/ydb/tests/functional/sqs/multinode/__init__.py new file mode 100644 index 00000000000..6ca2b961344 --- /dev/null +++ b/ydb/tests/functional/sqs/multinode/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +_author__ = 'komels@yandex-team.ru' diff --git a/ydb/tests/functional/sqs/test_multinode_cluster.py b/ydb/tests/functional/sqs/multinode/test_multinode_cluster.py index 047ae56198d..e06dceed882 100644 --- a/ydb/tests/functional/sqs/test_multinode_cluster.py +++ b/ydb/tests/functional/sqs/multinode/test_multinode_cluster.py @@ -9,9 +9,9 @@ from hamcrest import assert_that, equal_to, not_none, raises, not_ from ydb.tests.library.common.types import Erasure -from sqs_matchers import ReadResponseMatcher +from ydb.tests.library.sqs.matchers import ReadResponseMatcher -from sqs_test_base import KikimrSqsTestBase, STOP_NODE_PARAMS, IS_FIFO_PARAMS +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, STOP_NODE_PARAMS, IS_FIFO_PARAMS class TestSqsMultinodeCluster(KikimrSqsTestBase): diff --git a/ydb/tests/functional/sqs/test_recompiles_requests.py b/ydb/tests/functional/sqs/multinode/test_recompiles_requests.py index 367003323f6..ac721a57f53 100644 --- a/ydb/tests/functional/sqs/test_recompiles_requests.py +++ b/ydb/tests/functional/sqs/multinode/test_recompiles_requests.py @@ -5,7 +5,7 @@ from hamcrest import assert_that, not_none from ydb.tests.library.common.types import Erasure -from sqs_test_base import KikimrSqsTestBase, IS_FIFO_PARAMS +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, IS_FIFO_PARAMS class TestSqsRecompilesRequestsForOtherQueue(KikimrSqsTestBase): diff --git a/ydb/tests/functional/sqs/with_quotas/__init__.py b/ydb/tests/functional/sqs/with_quotas/__init__.py new file mode 100644 index 00000000000..6ca2b961344 --- /dev/null +++ b/ydb/tests/functional/sqs/with_quotas/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +_author__ = 'komels@yandex-team.ru' diff --git a/ydb/tests/functional/sqs/test_quoting.py b/ydb/tests/functional/sqs/with_quotas/test_quoting.py index e35e8f4a54f..f750f28d3da 100644 --- a/ydb/tests/functional/sqs/test_quoting.py +++ b/ydb/tests/functional/sqs/with_quotas/test_quoting.py @@ -6,9 +6,9 @@ import time import pytest from hamcrest import assert_that, raises, greater_than, contains_string, equal_to, instance_of -from sqs_requests_client import SqsSendMessageParams +from ydb.tests.library.sqs.requests_client import SqsSendMessageParams -from sqs_test_base import KikimrSqsTestBase, IS_FIFO_PARAMS +from ydb.tests.library.sqs.test_base import KikimrSqsTestBase, IS_FIFO_PARAMS from ydb import issues as ydb_issues diff --git a/ydb/tests/functional/sqs/sqs_matchers.py b/ydb/tests/library/sqs/matchers.py index a8bb8508fc9..a8bb8508fc9 100644 --- a/ydb/tests/functional/sqs/sqs_matchers.py +++ b/ydb/tests/library/sqs/matchers.py diff --git a/ydb/tests/functional/sqs/sqs_requests_client.py b/ydb/tests/library/sqs/requests_client.py index 6b7545503f2..6b7545503f2 100644 --- a/ydb/tests/functional/sqs/sqs_requests_client.py +++ b/ydb/tests/library/sqs/requests_client.py diff --git a/ydb/tests/functional/sqs/sqs_test_base.py b/ydb/tests/library/sqs/test_base.py index de6623b887c..ba292399e58 100644 --- a/ydb/tests/functional/sqs/sqs_test_base.py +++ b/ydb/tests/library/sqs/test_base.py @@ -15,14 +15,14 @@ import ydb.tests.library.common.yatest_common as yatest_common from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator from ydb.tests.library.harness.util import LogLevels -from ydb.tests.library.sqs.tables import create_all_tables as create_all_sqs_tables -from sqs_requests_client import SqsHttpApi +from ydb.tests.library.sqs.tables import create_all_tables as create_all_sqs_tables +from ydb.tests.library.sqs.requests_client import SqsHttpApi +from ydb.tests.library.sqs.matchers import ReadResponseMatcher import ydb from concurrent import futures -from sqs_matchers import ReadResponseMatcher DEFAULT_VISIBILITY_TIMEOUT = 30 @@ -64,10 +64,6 @@ def get_sqs_client_path(): return yatest_common.binary_path("ydb/core/ymq/client/bin/sqs") -def get_kikimr_driver_path(): - return yatest_common.binary_path("ydb/apps/ydbd/ydbd") - - def to_bytes(v): if v is None: return v @@ -635,6 +631,7 @@ class KikimrSqsTestBase(object): def _smart_make_table_path(self, user_name, queue_name, queue_version, shard, table_name): tables_format = self.tables_format_per_user.get(user_name, 0) + table_path = self.sqs_root if tables_format == 0: table_path += '/{}'.format(user_name) @@ -767,8 +764,12 @@ class KikimrSqsTestBase(object): if username is None: username = self._username self._execute_yql_query( - f'UPSERT INTO `{self.sqs_root}/.Settings` (Account, Name, Value) \ - VALUES ("{username}", "CreateQueuesWithTabletFormat", "{tables_format}")' + 'UPSERT INTO `{}/.Settings` (Account, Name, Value) \ + VALUES ("{}", "CreateQueuesWithTabletFormat", "{}")'.format( + self.sqs_root, + username, + tables_format + ) ) self.tables_format_per_user[username] = tables_format |