Skip to content

Support of different ydb flavours in tests #16213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ydb/tests/functional/tenants/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# but somehow it does not
#
# for ydb_{cluster, database, ...} fixture family
pytest_plugins = 'ydb.tests.library.fixtures'
pytest_plugins = ['ydb.tests.library.fixtures', 'ydb.tests.library.flavours']


@pytest.fixture(scope='module')
Expand Down
4 changes: 2 additions & 2 deletions ydb/tests/functional/tenants/test_users_groups_with_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def domain_login_only(request):


@pytest.fixture(scope='module')
def ydb_configurator(ydb_cluster_configuration, domain_login_only):
config_generator = KikimrConfigGenerator(**ydb_cluster_configuration)
def ydb_configurator(ydb_cluster_configuration, domain_login_only, ydb_flavour_path):
config_generator = KikimrConfigGenerator(binary_paths=[ydb_flavour_path], **ydb_cluster_configuration)
config_generator.yaml_config['auth_config'] = {
'domain_login_only': domain_login_only,
}
Expand Down
3 changes: 3 additions & 0 deletions ydb/tests/functional/tenants/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ TEST_SRCS(

SPLIT_FACTOR(20)

INCLUDE(${ARCADIA_ROOT}/ydb/tests/library/flavours/flavours_deps.inc)

DEPENDS(
ydb/apps/ydbd
)
Expand All @@ -27,6 +29,7 @@ PEERDIR(
contrib/python/requests
ydb/tests/library
ydb/tests/library/fixtures
ydb/tests/library/flavours
ydb/tests/library/clients
ydb/tests/oss/ydb_sdk_import
ydb/public/sdk/python
Expand Down
24 changes: 24 additions & 0 deletions ydb/tests/library/flavours/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

import yatest
import pytest

FLAVOUR_TO_PATH = {}

_PREFIX = "YDB_FLAVOUR_"

for key, value in os.environ.items():
if key.startswith(_PREFIX):
new_key = key[len(_PREFIX):]
FLAVOUR_TO_PATH[new_key] = value

if not FLAVOUR_TO_PATH:
raise RuntimeError("Flavours not found. Did you forget to include 'tests/library/flavours/flavours_deps.inc' in ya.make?")


@pytest.fixture(scope='module', params=FLAVOUR_TO_PATH.values(), ids=FLAVOUR_TO_PATH.keys())
def ydb_flavour_path(request):
"""
This fixture is a way to test different ydb flavours in one parametrized test
"""
return yatest.common.binary_path(request.param)
9 changes: 9 additions & 0 deletions ydb/tests/library/flavours/flavours_deps.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEPENDS(
ydb/apps/ydbd
)

ENV(YDB_FLAVOUR_YDB="ydb/apps/ydbd/ydbd")

IF (NOT OPENSOURCE)
INCLUDE(${ARCADIA_ROOT}/kikimr/tests/flavours/flavours_deps.inc)
ENDIF()
7 changes: 7 additions & 0 deletions ydb/tests/library/flavours/ya.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PY3_LIBRARY()

PY_SRCS(
__init__.py
)

END()
1 change: 1 addition & 0 deletions ydb/tests/library/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ END()
RECURSE(
compatibility
clients
flavours
serializability
test_meta
wardens
Expand Down