diff options
author | svc <svc@yandex-team.ru> | 2022-02-10 16:50:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:23 +0300 |
commit | b52616d775abd70c27365aa9721e9ee71bfc77d2 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /ydb/tests/functional/rename/conftest.py | |
parent | eb48c66d105713a2574106c798c8b6387643f5c7 (diff) | |
download | ydb-b52616d775abd70c27365aa9721e9ee71bfc77d2.tar.gz |
Restoring authorship annotation for <svc@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'ydb/tests/functional/rename/conftest.py')
-rw-r--r-- | ydb/tests/functional/rename/conftest.py | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/ydb/tests/functional/rename/conftest.py b/ydb/tests/functional/rename/conftest.py index 359e1f0c871..660670cb0a6 100644 --- a/ydb/tests/functional/rename/conftest.py +++ b/ydb/tests/functional/rename/conftest.py @@ -1,106 +1,106 @@ -# -*- coding: utf-8 -*- -import os -import logging -import pytest -import contextlib - +# -*- coding: utf-8 -*- +import os +import logging +import pytest +import contextlib + from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator from ydb.tests.library.common.types import Erasure - - -logger = logging.getLogger(__name__) - - -@pytest.fixture(scope='module') -def local_cluster_configuration(): - configurator = KikimrConfigGenerator( - erasure=Erasure.NONE, - nodes=3, - n_to_select=1, - additional_log_configs={ - 'FLAT_TX_SCHEMESHARD': 7, - 'SCHEME_BOARD_POPULATOR': 4, - 'SCHEME_BOARD_SUBSCRIBER': 4, - } - ) - return configurator - - -@pytest.fixture(scope='module') -def ydb_cluster(local_cluster_configuration, request): - module_name = request.module.__name__ - - logger.info("setup ydb_cluster for %s", module_name) - - logger.info("setup ydb_cluster as local") - cluster = kikimr_cluster_factory( - configurator=local_cluster_configuration - ) - cluster.is_local_test = True - - cluster.start() - - yield cluster - - logger.info("destroy ydb_cluster for %s", module_name) - cluster.stop() - - -@pytest.fixture(scope='module') -def ydb_root(ydb_cluster): + + +logger = logging.getLogger(__name__) + + +@pytest.fixture(scope='module') +def local_cluster_configuration(): + configurator = KikimrConfigGenerator( + erasure=Erasure.NONE, + nodes=3, + n_to_select=1, + additional_log_configs={ + 'FLAT_TX_SCHEMESHARD': 7, + 'SCHEME_BOARD_POPULATOR': 4, + 'SCHEME_BOARD_SUBSCRIBER': 4, + } + ) + return configurator + + +@pytest.fixture(scope='module') +def ydb_cluster(local_cluster_configuration, request): + module_name = request.module.__name__ + + logger.info("setup ydb_cluster for %s", module_name) + + logger.info("setup ydb_cluster as local") + cluster = kikimr_cluster_factory( + configurator=local_cluster_configuration + ) + cluster.is_local_test = True + + cluster.start() + + yield cluster + + logger.info("destroy ydb_cluster for %s", module_name) + cluster.stop() + + +@pytest.fixture(scope='module') +def ydb_root(ydb_cluster): return os.path.join("/", ydb_cluster.domain_name) - - -@pytest.fixture(scope='module') -def ydb_private_client(ydb_cluster): - return ydb_cluster.client - - -@pytest.fixture(scope='module') -def ydb_endpoint(ydb_cluster): - return "%s:%s" % (ydb_cluster.nodes[1].host, ydb_cluster.nodes[1].port) - - -@pytest.fixture(scope='function') -def extended_test_name(request): - return request.node.name - - -@contextlib.contextmanager -def ydb_database_ctx(ydb_cluster, database, timeout_seconds=300): - logger.info("setup ydb_database %s", database) - - ydb_cluster.remove_database( - database, - timeout_seconds=timeout_seconds - ) - - ydb_cluster.create_database( - database, - storage_pool_units_count={ - 'hdd': 1 - }, - timeout_seconds=timeout_seconds - ) + + +@pytest.fixture(scope='module') +def ydb_private_client(ydb_cluster): + return ydb_cluster.client + + +@pytest.fixture(scope='module') +def ydb_endpoint(ydb_cluster): + return "%s:%s" % (ydb_cluster.nodes[1].host, ydb_cluster.nodes[1].port) + + +@pytest.fixture(scope='function') +def extended_test_name(request): + return request.node.name + + +@contextlib.contextmanager +def ydb_database_ctx(ydb_cluster, database, timeout_seconds=300): + logger.info("setup ydb_database %s", database) + + ydb_cluster.remove_database( + database, + timeout_seconds=timeout_seconds + ) + + ydb_cluster.create_database( + database, + storage_pool_units_count={ + 'hdd': 1 + }, + timeout_seconds=timeout_seconds + ) slots = ydb_cluster.register_and_start_slots(database, count=1) - - try: - yield database - finally: - logger.info("destroy ydb_database for %s", database) + + try: + yield database + finally: + logger.info("destroy ydb_database for %s", database) for slot in slots: slot.stop() - ydb_cluster.remove_database( - database, - timeout_seconds=timeout_seconds - ) - - -@pytest.fixture(scope='function') -def ydb_database(ydb_cluster, ydb_root, extended_test_name): - database = os.path.join(ydb_root, extended_test_name.replace("[", "_").replace("]", "_")) - - with ydb_database_ctx(ydb_cluster, database): - yield database + ydb_cluster.remove_database( + database, + timeout_seconds=timeout_seconds + ) + + +@pytest.fixture(scope='function') +def ydb_database(ydb_cluster, ydb_root, extended_test_name): + database = os.path.join(ydb_root, extended_test_name.replace("[", "_").replace("]", "_")) + + with ydb_database_ctx(ydb_cluster, database): + yield database |