From 9dca7719b107d115ac8fc2391358a2db839b73bd Mon Sep 17 00:00:00 2001 From: Andrei Chekun Date: Wed, 9 Apr 2025 13:43:34 +0200 Subject: [PATCH] test.py: switch off C++ tests from test.py discovery Switch off C++ tests from test.py discovery. With this change, test.py loses the ability to directly see and run the C++ tests. Instead, it'll delegate all things to the pytest. Since boost, raft, unit, and ldap directories aren't executed by test.py, suite.yaml files are renamed to test_config.yaml to preserve the old way of test configuration and removing them from execution by test.py Before this patch boost test were visible by test.py and pytest. So if the test.py will be invoked without test name, it will execute boost tests twice: with test.py executor and with pytest executor. Depending on the test name according executor will be used. For example, if test name is test/boost/aggregate_fcts_test.cc it will be executed by pytest, but if the boost/aggregate_fcts_test it will be executed by test.py executor. --- test.py | 10 +++++----- test/boost/{suite.yaml => test_config.yaml} | 1 - test/ldap/{suite.yaml => test_config.yaml} | 1 - test/pylib/cpp/common_cpp_conftest.py | 14 ++++++++++---- test/raft/{suite.yaml => test_config.yaml} | 1 - test/unit/{suite.yaml => test_config.yaml} | 2 -- 6 files changed, 15 insertions(+), 14 deletions(-) rename test/boost/{suite.yaml => test_config.yaml} (99%) rename test/ldap/{suite.yaml => test_config.yaml} (92%) rename test/raft/{suite.yaml => test_config.yaml} (84%) rename test/unit/{suite.yaml => test_config.yaml} (91%) diff --git a/test.py b/test.py index 5547206adc..7d124e3a0a 100755 --- a/test.py +++ b/test.py @@ -420,14 +420,14 @@ async def run_all_tests(signaled: asyncio.Event, options: argparse.Namespace) -> await start_3rd_party_services(tempdir_base=pathlib.Path(options.tmpdir), toxiproxy_byte_limit=options.byte_limit) total_tests = 0 - for i in range(1, options.repeat+1): - result = run_pytest(options, run_id=i) - total_tests += result[0] - failed_tests.extend(result[1]) - console.print_start_blurb() max_failures = options.max_failures failed = 0 try: + for i in range(1, options.repeat + 1): + result = run_pytest(options, run_id=i) + total_tests += result[0] + failed_tests.extend(result[1]) + console.print_start_blurb() TestSuite.artifacts.add_exit_artifact(None, TestSuite.hosts.cleanup) for test in TestSuite.all_tests(): # +1 for 'signaled' event diff --git a/test/boost/suite.yaml b/test/boost/test_config.yaml similarity index 99% rename from test/boost/suite.yaml rename to test/boost/test_config.yaml index e7332c1717..53875549ff 100644 --- a/test/boost/suite.yaml +++ b/test/boost/test_config.yaml @@ -1,4 +1,3 @@ -type: boost extra_scylla_cmdline_options: - '--reactor-backend linux-aio' # A list of long tests, which should be started early diff --git a/test/ldap/suite.yaml b/test/ldap/test_config.yaml similarity index 92% rename from test/ldap/suite.yaml rename to test/ldap/test_config.yaml index 09febcabee..8616afe824 100644 --- a/test/ldap/suite.yaml +++ b/test/ldap/test_config.yaml @@ -1,4 +1,3 @@ -type: ldap # Custom command line arguments for some of the tests custom_args: {} extra_scylla_cmdline_options: diff --git a/test/pylib/cpp/common_cpp_conftest.py b/test/pylib/cpp/common_cpp_conftest.py index 62b9850533..bb12415a71 100644 --- a/test/pylib/cpp/common_cpp_conftest.py +++ b/test/pylib/cpp/common_cpp_conftest.py @@ -16,6 +16,7 @@ from test.pylib.cpp.item import CppFile, coverage from test.pylib.util import get_modes_to_run +TEST_CONFIG = 'test_config.yaml' DEFAULT_ARGS = [ '--overprovisioned', '--unsafe-bypass-fsync 1', @@ -71,13 +72,18 @@ def get_disabled_tests(config: dict, modes: list[str]) -> dict[str, set[str]]: def read_suite_config(directory: Path) -> dict[str, str]: """ - Helper method that will return the configuration from the suite.yaml file + Helper method that returns the configuration from the test_config.yaml file. + It can be that there's no test_config.yaml that means there are no additional parameters for Scylla itself or no + filtering on what modes tests should be executed or skipped """ - with open(directory / 'suite.yaml', 'r') as cfg_file: - cfg = yaml.safe_load(cfg_file.read()) + config = directory / TEST_CONFIG + if config.exists() and config.stat().st_size: + cfg = yaml.safe_load(config.read_text(encoding='utf-8')) if not isinstance(cfg, dict): - raise RuntimeError('Failed to load tests: suite.yaml is empty') + raise ValueError(f"Invalid {TEST_CONFIG} format in {directory}. Expected a dictionary, got {type(cfg)}") return cfg + else: + return {} def collect_items(file_path: PosixPath, parent: Collector, facade: CppTestFacade) -> object: diff --git a/test/raft/suite.yaml b/test/raft/test_config.yaml similarity index 84% rename from test/raft/suite.yaml rename to test/raft/test_config.yaml index 46076f768e..c969549e58 100644 --- a/test/raft/suite.yaml +++ b/test/raft/test_config.yaml @@ -1,3 +1,2 @@ -type: boost extra_scylla_cmdline_options: - '--reactor-backend linux-aio' diff --git a/test/unit/suite.yaml b/test/unit/test_config.yaml similarity index 91% rename from test/unit/suite.yaml rename to test/unit/test_config.yaml index de29f9219d..35c4fd90fa 100644 --- a/test/unit/suite.yaml +++ b/test/unit/test_config.yaml @@ -1,5 +1,3 @@ -# Suite test type. Supported types: unit, boost, cql -type: unit # A list of tests that are only run in dev and release modes skip_in_debug_modes: - lsa_async_eviction_test