diff options
author | thistle <thistle@yandex-team.ru> | 2022-02-10 16:52:21 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:52:21 +0300 |
commit | ef9857941e06b34cf3e6b5269c36bb19e75b5d9d (patch) | |
tree | 1ad13f70d86d5df3b800c5e56d3a555d17ae534c | |
parent | 57d878af942e78206675efc83be53348b9834168 (diff) | |
download | ydb-ef9857941e06b34cf3e6b5269c36bb19e75b5d9d.tar.gz |
Restoring authorship annotation for <thistle@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | ydb/tests/functional/hive/test_kill_tablets.py | 20 | ||||
-rw-r--r-- | ydb/tests/functional/hive/ya.make | 4 | ||||
-rw-r--r-- | ydb/tests/library/common/delayed.py | 6 | ||||
-rw-r--r-- | ydb/tests/library/common/msgbus_types.py | 82 | ||||
-rw-r--r-- | ydb/tests/library/common/types.py | 78 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_client.py | 30 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_cluster.py | 20 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_config.py | 12 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_runner.py | 44 | ||||
-rw-r--r-- | ydb/tests/library/matchers/response.py | 6 | ||||
-rw-r--r-- | ydb/tests/library/matchers/tablets.py | 16 |
11 files changed, 159 insertions, 159 deletions
diff --git a/ydb/tests/functional/hive/test_kill_tablets.py b/ydb/tests/functional/hive/test_kill_tablets.py index 08dbd5c0b1a..c09fd80dd55 100644 --- a/ydb/tests/functional/hive/test_kill_tablets.py +++ b/ydb/tests/functional/hive/test_kill_tablets.py @@ -6,31 +6,31 @@ from ydb.tests.library.common.types import TabletTypes, TabletStates from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory from ydb.tests.library.matchers.response import is_ok_response, is_valid_response_with_field from ydb.tests.library.kv.helpers import create_tablets_and_wait_for_start - + TIMEOUT_SECONDS = 180 NUMBER_OF_TABLETS = 4 - + class TestKillTablets(object): @classmethod def setup_class(cls): cls.cluster = kikimr_cluster_factory() cls.cluster.start() - + @classmethod def teardown_class(cls): if hasattr(cls, 'cluster'): cls.cluster.stop() - + def test_when_kill_keyvalue_tablet_it_will_be_restarted(self): # Arrange all_created_tablet_ids = create_tablets_and_wait_for_start(self.cluster.client, NUMBER_OF_TABLETS) actual_tablet_info = self.cluster.client.tablet_state(tablet_ids=all_created_tablet_ids).TabletStateInfo - + # Act for tablet_id in all_created_tablet_ids: self.cluster.client.tablet_kill(tablet_id) - + generations = {info.TabletId: info.Generation for info in actual_tablet_info} wait_tablets_state_by_id( self.cluster.client, @@ -40,7 +40,7 @@ class TestKillTablets(object): generation_matcher=greater_than, timeout_seconds=TIMEOUT_SECONDS, ) - + def test_when_kill_hive_it_will_be_restarted_and_can_create_tablets(self): # Arrange hive_state_response = self.cluster.client.tablet_state(tablet_type=TabletTypes.FLAT_HIVE) @@ -49,7 +49,7 @@ class TestKillTablets(object): is_valid_response_with_field('TabletStateInfo', has_length(1)) ) hive_id = hive_state_response.TabletStateInfo[0].TabletId - + # Act response = self.cluster.client.tablet_kill(hive_id) assert_that( @@ -63,9 +63,9 @@ class TestKillTablets(object): tablet_ids=[hive_id], message='Hive is Active' ) - + all_tablet_ids = create_tablets_and_wait_for_start(self.cluster.client, NUMBER_OF_TABLETS) - + # Assert wait_tablets_state_by_id( self.cluster.client, diff --git a/ydb/tests/functional/hive/ya.make b/ydb/tests/functional/hive/ya.make index 60c5fdbf137..d8292589176 100644 --- a/ydb/tests/functional/hive/ya.make +++ b/ydb/tests/functional/hive/ya.make @@ -1,5 +1,5 @@ OWNER(g:kikimr) - + PY3TEST() ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd") TEST_SRCS( @@ -8,7 +8,7 @@ TEST_SRCS( test_kill_tablets.py test_drain.py ) - + REQUIREMENTS( cpu:4 diff --git a/ydb/tests/library/common/delayed.py b/ydb/tests/library/common/delayed.py index 98aca17df0f..00549e1d2bb 100644 --- a/ydb/tests/library/common/delayed.py +++ b/ydb/tests/library/common/delayed.py @@ -2,12 +2,12 @@ from hamcrest import has_properties, contains_inanyorder, is_not import logging import time - + from ydb.tests.library.common.wait_for import wait_for_and_assert, wait_for from ydb.tests.library.matchers.response_matchers import DynamicFieldsProtobufMatcher from ydb.tests.library.common.types import TabletStates from ydb.tests.library.wardens import hive - + logger = logging.getLogger(__name__) @@ -21,7 +21,7 @@ def wait_tablets_state_by_id( def query_tablet_state(): return client.tablet_state(tablet_ids=tablet_ids) - + wait_for_and_assert( query_tablet_state, DynamicFieldsProtobufMatcher().TabletStateInfo( diff --git a/ydb/tests/library/common/msgbus_types.py b/ydb/tests/library/common/msgbus_types.py index 475837f0cde..6ad4a03ea79 100644 --- a/ydb/tests/library/common/msgbus_types.py +++ b/ydb/tests/library/common/msgbus_types.py @@ -1,58 +1,58 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python +# -*- coding: utf-8 -*- import enum - - + + @enum.unique class MessageBusStatus(enum.IntEnum): - """ - Message Bus response statuses. - - See /arcadia/kikimr/core/client/base/msgbus.h - + """ + Message Bus response statuses. + + See /arcadia/kikimr/core/client/base/msgbus.h + See /arcadia/ydb/core/protos/msgbus.proto - """ - - # These are from /arcadia/kikimr/core/client/base/msgbus.h - MSTATUS_UNKNOWN = 0 - MSTATUS_OK = 1 - MSTATUS_ERROR = 128 - MSTATUS_INPROGRESS = 129 - MSTATUS_TIMEOUT = 130 - MSTATUS_NOTREADY = 131 - MSTATUS_ABORTED = 132 - MSTATUS_INTERNALERROR = 133 - MSTATUS_REJECTED = 134 - + """ + + # These are from /arcadia/kikimr/core/client/base/msgbus.h + MSTATUS_UNKNOWN = 0 + MSTATUS_OK = 1 + MSTATUS_ERROR = 128 + MSTATUS_INPROGRESS = 129 + MSTATUS_TIMEOUT = 130 + MSTATUS_NOTREADY = 131 + MSTATUS_ABORTED = 132 + MSTATUS_INTERNALERROR = 133 + MSTATUS_REJECTED = 134 + @staticmethod def is_ok_status(status): return status in ( MessageBusStatus.MSTATUS_OK, MessageBusStatus.MSTATUS_INPROGRESS ) - + @enum.unique class EMessageStatus(enum.IntEnum): - """ + """ See /arcadia/library/cpp/messagebus/message_status.h - """ - MESSAGE_OK = 0 - MESSAGE_CONNECT_FAILED = 1 - MESSAGE_TIMEOUT = 2 - MESSAGE_SERVICE_UNKNOWN = 3 - MESSAGE_BUSY = 4 - MESSAGE_UNKNOWN = 5 - MESSAGE_DESERIALIZE_ERROR = 6 - MESSAGE_HEADER_CORRUPTED = 7 - MESSAGE_DECOMPRESS_ERROR = 8 - MESSAGE_MESSAGE_TOO_LARGE = 9 - MESSAGE_REPLY_FAILED = 10 - MESSAGE_DELIVERY_FAILED = 11 - MESSAGE_INVALID_VERSION = 12 - MESSAGE_SERVICE_TOOMANY = 13 - MESSAGE_SHUTDOWN = 14 - MESSAGE_DONT_ASK = 15 + """ + MESSAGE_OK = 0 + MESSAGE_CONNECT_FAILED = 1 + MESSAGE_TIMEOUT = 2 + MESSAGE_SERVICE_UNKNOWN = 3 + MESSAGE_BUSY = 4 + MESSAGE_UNKNOWN = 5 + MESSAGE_DESERIALIZE_ERROR = 6 + MESSAGE_HEADER_CORRUPTED = 7 + MESSAGE_DECOMPRESS_ERROR = 8 + MESSAGE_MESSAGE_TOO_LARGE = 9 + MESSAGE_REPLY_FAILED = 10 + MESSAGE_DELIVERY_FAILED = 11 + MESSAGE_INVALID_VERSION = 12 + MESSAGE_SERVICE_TOOMANY = 13 + MESSAGE_SHUTDOWN = 14 + MESSAGE_DONT_ASK = 15 @enum.unique diff --git a/ydb/tests/library/common/types.py b/ydb/tests/library/common/types.py index 5ec564d65fa..001f942cc1f 100644 --- a/ydb/tests/library/common/types.py +++ b/ydb/tests/library/common/types.py @@ -7,7 +7,7 @@ from enum import unique, Enum, IntEnum from ydb.tests.library.common.generators import int_between, one_of, float_in, string_with_length, actor_id -@unique +@unique class DeltaTypes(IntEnum): AddTable = 1, DropTable = 2, @@ -66,35 +66,35 @@ class Erasure(Enum): MIRROR_3_2 = _erasure_type(id_=8, min_fail_domains=5, min_alive_replicas=3) MIRROR_3_DC = _erasure_type(id_=9, min_fail_domains=3, min_alive_replicas=3) MIRROR_3OF4 = _erasure_type(id_=18, min_fail_domains=8, min_alive_replicas=6) - - def __init__(self, id_, min_fail_domains, min_alive_replicas): + + def __init__(self, id_, min_fail_domains, min_alive_replicas): self.__id = id_ self.__min_fail_domains = min_fail_domains - self.__min_alive_replicas = min_alive_replicas + self.__min_alive_replicas = min_alive_replicas - def __str__(self): + def __str__(self): return self.name.replace("_", "-").lower() - - def __repr__(self): - return self.__str__() - + + def __repr__(self): + return self.__str__() + def __int__(self): return self.__id - + @property def min_fail_domains(self): return self.__min_fail_domains - @property - def min_alive_replicas(self): - return self.__min_alive_replicas - - @staticmethod - def from_string(string_): - string_ = string_.upper() - string_ = string_.replace("-", "_") - return Erasure[string_] + @property + def min_alive_replicas(self): + return self.__min_alive_replicas + @staticmethod + def from_string(string_): + string_ = string_.upper() + string_ = string_.replace("-", "_") + return Erasure[string_] + @staticmethod def from_int(species): for candidate in list(Erasure): @@ -111,19 +111,19 @@ class Erasure(Enum): @unique -class TabletStates(IntEnum): - Created = 0, - ResolveStateStorage = 1, - Candidate = 2, - BlockBlobStorage = 3, - RebuildGraph = 4, - WriteZeroEntry = 5, - Restored = 6, - Discover = 7, - Lock = 8, - Dead = 9, +class TabletStates(IntEnum): + Created = 0, + ResolveStateStorage = 1, + Candidate = 2, + BlockBlobStorage = 3, + RebuildGraph = 4, + WriteZeroEntry = 5, + Restored = 6, + Discover = 7, + Lock = 8, + Dead = 9, Active = 10 - + @staticmethod def from_int(val): for tablet_state in list(TabletStates): @@ -141,7 +141,7 @@ def _tablet_type(id_, magic, is_unique=False, service_name=None): return id_, magic, is_unique, service_name -@unique +@unique class TabletTypes(Enum): TX_DUMMY = _tablet_type(8, 999) RTMR_PARTITION = _tablet_type(10, 999) @@ -229,9 +229,9 @@ class AbstractTypeEnum(Enum): def as_obj(self, value): return self.to_obj_converter(value) - @property - def idn(self): - return self._idn_ + @property + def idn(self): + return self._idn_ @classmethod def from_int(cls, idn): @@ -239,7 +239,7 @@ class AbstractTypeEnum(Enum): if idn == v._idn_: return v raise AssertionError('There is no PType with value = ' + str(idn)) - + def from_bytes(val): try: @@ -264,20 +264,20 @@ class PType(AbstractTypeEnum): Double = _ptype_from(32, float_in(-100, 100), float, proto_field='Double') Float = _ptype_from(33, float_in(-100, 100), float, proto_field='Float') - + # Rework Pair later PairUi64Ui64 = _ptype_from(257, int_between(0, 2 ** 64 - 1), int) String = _ptype_from(4097, string_with_length(4), str) SmallBoundedString = _ptype_from(4113, string_with_length(4), str) LargeBoundedString = _ptype_from(4114, string_with_length(500), str) - + Utf8 = _ptype_from(4608, string_with_length(500), from_bytes) ActorID = _ptype_from(8193, actor_id(), str) def __init__(self, idn, generator, to_obj_converter, proto_field, min_value, max_value): - self._idn_ = idn + self._idn_ = idn self.generator = generator self.to_obj_converter = to_obj_converter self._proto_field = proto_field diff --git a/ydb/tests/library/harness/kikimr_client.py b/ydb/tests/library/harness/kikimr_client.py index d74383ae231..1f04f9164ea 100644 --- a/ydb/tests/library/harness/kikimr_client.py +++ b/ydb/tests/library/harness/kikimr_client.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python +# -*- coding: utf-8 -*- import time import os from ydb.tests.library.common.msgbus_types import MessageBusStatus from ydb.tests.library.common.protobuf_ss import TSchemeOperationStatus - + import grpc import six @@ -34,8 +34,8 @@ def kikimr_client_factory(server, port, cluster=None, retry_count=1): server, port, cluster=cluster, retry_count=retry_count ) - - + + def channels_list(): return os.getenv('CHANNELS_LIST', '') @@ -54,9 +54,9 @@ def to_bytes(v): class KiKiMRMessageBusClient(object): def __init__(self, server, port, cluster=None, retry_count=1): - self.server = server - self.port = port - self._cluster = cluster + self.server = server + self.port = port + self._cluster = cluster self.__domain_id = 1 self.__retry_count = retry_count self.__retry_sleep_seconds = 10 @@ -66,7 +66,7 @@ class KiKiMRMessageBusClient(object): ] self._channel = grpc.insecure_channel("%s:%s" % (self.server, self.port), options=self._options) self._stub = grpc_server.TGRpcServerStub(self._channel) - + def describe(self, path, token): request = msgbus.TSchemeDescribe() request.Path = path @@ -165,13 +165,13 @@ class KiKiMRMessageBusClient(object): request.FlatTxId.SchemeShardTabletId = tablet_id request.PollOptions.Timeout = timeout * 1000 return self.invoke(request, 'SchemeOperationStatus') - + def send(self, request, method): return self.invoke(request, method) - + def ddl_exec_status(self, flat_tx_id): return self.flat_transaction_status(flat_tx_id.tx_id, flat_tx_id.schemeshard_tablet_id) - + def add_attr(self, working_dir, name, attributes, token=None): request = msgbus.TSchemeOperation() request.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpAlterUserAttributes @@ -242,7 +242,7 @@ class KiKiMRMessageBusClient(object): request, 'HiveCreateTablet' ) - + def local_enumerate_tablets(self, tablet_type, node_id=1): request = msgbus.TLocalEnumerateTablets() request.DomainUid = self.__domain_id @@ -379,7 +379,7 @@ class KiKiMRMessageBusClient(object): request.DeadlineInstantMs = deadline_ms return self.invoke(request, 'KeyValue') - def tablet_kill(self, tablet_id): + def tablet_kill(self, tablet_id): request = msgbus.TTabletKillRequest(TabletID=tablet_id) return self.invoke(request, 'TabletKillRequest') @@ -391,6 +391,6 @@ class KiKiMRMessageBusClient(object): request.TabletIDs.extend(tablet_ids) request.Alive = True return self.invoke(request, 'TabletStateRequest') - + def __del__(self): self.close() diff --git a/ydb/tests/library/harness/kikimr_cluster.py b/ydb/tests/library/harness/kikimr_cluster.py index 942e1588ca4..a60ab4f9d5f 100644 --- a/ydb/tests/library/harness/kikimr_cluster.py +++ b/ydb/tests/library/harness/kikimr_cluster.py @@ -22,17 +22,17 @@ DEFAULT_INTERCONNECT_PORT = 19001 DEFAULT_MBUS_PORT = 2134 DEFAULT_MON_PORT = 8765 DEFAULT_GRPC_PORT = 2135 - - + + def kikimr_cluster_factory(configurator=None, config_path=None): logger.info("All test params = {}".format(pprint.pformat(yatest_common.get_param_dict_copy()))) logger.info("Starting standalone YDB cluster") if config_path is not None: return ExternalKiKiMRCluster(config_path) - else: + else: return KiKiMR(configurator) - - + + def load_yaml(path): with open(path, 'r') as r: data = yaml.safe_load(r.read()) @@ -54,11 +54,11 @@ class ExternalKiKiMRCluster(KiKiMRClusterInterface): self.__slot_count = max(self.__slot_count, domain['dynamic_slots']) super(ExternalKiKiMRCluster, self).__init__() - - @property - def config(self): - return self.__config - + + @property + def config(self): + return self.__config + def add_storage_pool(self, erasure=None): raise NotImplementedError() diff --git a/ydb/tests/library/harness/kikimr_config.py b/ydb/tests/library/harness/kikimr_config.py index 57c282b9f41..318c592af39 100644 --- a/ydb/tests/library/harness/kikimr_config.py +++ b/ydb/tests/library/harness/kikimr_config.py @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- import sys import itertools -import os +import os import tempfile import socket import six - + from google.protobuf.text_format import Parse from ydb.core.protos import config_pb2 import ydb.tests.library.common.yatest_common as yatest_common - + from . import tls_tools from ydb.tests.library.common.types import Erasure from .kikimr_port_allocator import KikimrPortManagerPortAllocator @@ -17,7 +17,7 @@ from .param_constants import kikimr_driver_path from .util import LogLevels import yaml from library.python import resource - + PDISK_SIZE_STR = os.getenv("YDB_PDISK_SIZE", str(64 * 1024 * 1024 * 1024)) if PDISK_SIZE_STR.endswith("GB"): @@ -353,7 +353,7 @@ class KikimrConfigGenerator(object): def all_node_ids(self): return self.__node_ids - + def _add_pdisk_to_static_group(self, pdisk_id, path, node_id, pdisk_category, ring): domain_id = len(self.yaml_config['blob_storage_config']["service_set"]["groups"][0]["rings"][ring]["fail_domains"]) self.yaml_config['blob_storage_config']["service_set"]["pdisks"].append( @@ -377,7 +377,7 @@ class KikimrConfigGenerator(object): self.yaml_config["blob_storage_config"]["service_set"]["vdisks"] = [] self.yaml_config["blob_storage_config"]["service_set"]["groups"] = [{"group_id": 0, 'group_generation': 0, 'erasure_species': int(self.static_erasure)}] self.yaml_config["blob_storage_config"]["service_set"]["groups"][0]["rings"] = [] - + for dc in self._dcs: self.yaml_config["blob_storage_config"]["service_set"]["groups"][0]["rings"].append({"fail_domains": []}) diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py index 251f485b5db..1c6e99b6d8c 100644 --- a/ydb/tests/library/harness/kikimr_runner.py +++ b/ydb/tests/library/harness/kikimr_runner.py @@ -48,7 +48,7 @@ def join(a, b): class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface): def __init__(self, node_idx, config_path, port_allocator, cluster_name, configurator, udfs_dir=None, role='node', node_broker_port=None, tenant_affiliation=None, encryption_key=None): - + super(kikimr_node_interface.NodeInterface, self).__init__() self.node_id = node_idx self.__cwd = None @@ -163,7 +163,7 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface): logger.info('CFG_DIR_PATH="%s"', self.__config_path) logger.info("Final command: %s", ' '.join(command).replace(self.__config_path, '$CFG_DIR_PATH')) - return command + return command def stop(self): try: @@ -222,7 +222,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): self._slot_index_allocator = itertools.count(1) self._node_index_allocator = itertools.count(1) self.default_channel_bindings = None - + @property def config(self): return self.__configurator @@ -262,11 +262,11 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): )) raise - def start(self): - """ - Safely starts kikimr instance. - Do not override this method. + def start(self): """ + Safely starts kikimr instance. + Do not override this method. + """ try: logger.debug("Working directory: " + self.__tmpdir) self.__run() @@ -276,7 +276,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): logger.exception("KiKiMR start failed") self.stop() raise - + def __run(self): self.__client = None @@ -305,8 +305,8 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): self.client.bind_storage_pools(self.domain_name, pools) default_pool_name = list(pools.keys())[0] self.default_channel_bindings = {idx: default_pool_name for idx in range(3)} - logger.info("Cluster started and initialized") - + logger.info("Cluster started and initialized") + self.client.add_config_item( resource.find( "harness/resources/default_profile.txt" @@ -314,26 +314,26 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): ) def __run_node(self, node_id): - """ - :returns started KiKiMRNode instance - Can be overriden. - """ + """ + :returns started KiKiMRNode instance + Can be overriden. + """ self.__format_disks(node_id) self._nodes[node_id].start() return self._nodes[node_id] - + def __register_node(self): node_index = next(self._node_index_allocator) self._nodes[node_index] = KiKiMRNode( node_index, - self.config_path, + self.config_path, port_allocator=self.__port_allocator.get_node_port_allocator(node_index), cluster_name=self.__cluster_name, configurator=self.__configurator, udfs_dir=self.__common_udfs_dir, - ) + ) return self._nodes[node_index] - + def register_slots(self, database, count=1, encryption_key=None): return [self.register_slot(database, encryption_key) for _ in range(count)] @@ -379,7 +379,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): shutil.rmtree(self.__common_udfs_dir, ignore_errors=True) return ret - def stop(self): + def stop(self): saved_exceptions = [] for slot in self.slots.values(): @@ -515,7 +515,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): ) assert bs_controller_started - + class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeInterface): def __init__( self, node_id, host, port, mon_port, ic_port, mbus_port, configurator=None, slot_id=None): @@ -569,7 +569,7 @@ class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeIn ] ) - def stop(self): + def stop(self): if self.__slot_id is None: return self.ssh_command("sudo stop kikimr") return self.ssh_command( @@ -584,7 +584,7 @@ class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeIn "ic={}".format(self.__ic_port), ] ) - + @property def cwd(self): assert False, "not supported" diff --git a/ydb/tests/library/matchers/response.py b/ydb/tests/library/matchers/response.py index d492116b4b2..be2a707259c 100644 --- a/ydb/tests/library/matchers/response.py +++ b/ydb/tests/library/matchers/response.py @@ -10,7 +10,7 @@ from ydb.tests.library.common.msgbus_types import EReplyStatus, TStorageStatusFl from ydb.tests.library.common.msgbus_types import MessageBusStatus from ydb.tests.library.matchers.collection import contains from ydb.tests.library.matchers.response_matchers import ProtobufWithStatusMatcher - + def to_bytes(v): if v is None: @@ -218,10 +218,10 @@ def is_response_with_status(status): return ProtobufWithStatusMatcher(status) -def is_ok_response(): +def is_ok_response(): return is_response_with_status(MessageBusStatus.MSTATUS_OK) - + def is_valid_response_with_field(field_name, field_matcher): return all_of( has_property('Status', MessageBusStatus.MSTATUS_OK), diff --git a/ydb/tests/library/matchers/tablets.py b/ydb/tests/library/matchers/tablets.py index c73b8e42972..e4bcaa7f847 100644 --- a/ydb/tests/library/matchers/tablets.py +++ b/ydb/tests/library/matchers/tablets.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- - + from hamcrest import has_property, all_of, has_length, has_items, anything from hamcrest.core.base_matcher import BaseMatcher from hamcrest.core.helpers.wrap_matcher import wrap_matcher - + from ydb.tests.library.common.msgbus_types import EMessageStatus, MessageBusStatus def all_tablets_are_created(tablets_to_create): - return all_of( + return all_of( has_property('Status', MessageBusStatus.MSTATUS_OK), has_property( 'CreateTabletResult', - all_of( - has_length(len(tablets_to_create)), + all_of( + has_length(len(tablets_to_create)), has_items(has_property('Status', EMessageStatus.MESSAGE_OK)) - ) - ) - ) + ) + ) + ) def is_balanced_list(lst, exact_values): |