From 58d3052ad49643a5eab7980ef231dd3e2e93fb07 Mon Sep 17 00:00:00 2001 From: Andrei Chekun Date: Wed, 14 Jan 2026 16:10:24 +0100 Subject: [PATCH] test.py: pass correctly extra cmd line arguments During rewrite --extra-scylla-cmdline-options was missed and it was not passed to the tests that are using pytest. The issue that there were no possibility to pass these parameters via cmd to the Scylla, while tests were not affected because they were using the parameters from the yaml file. This PR fixes this issue so it will be easier to modify the Scylla start parameters without modifying code. --- test.py | 2 ++ test/pylib/cpp/base.py | 3 ++- test/pylib/runner.py | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test.py b/test.py index 45218d5f9c..94f2b8d628 100755 --- a/test.py +++ b/test.py @@ -376,6 +376,8 @@ def run_pytest(options: argparse.Namespace) -> tuple[int, list[SimpleNamespace]] args.append(f'-k={" and ".join([f"not {pattern}" for pattern in options.skip_patterns])}') if options.k: args.append(f'-k={options.k}') + if options.extra_scylla_cmdline_options: + args.append(f'--extra-scylla-cmdline-options={options.extra_scylla_cmdline_options}') if not options.save_log_on_success: args.append('--allure-no-capture') else: diff --git a/test/pylib/cpp/base.py b/test/pylib/cpp/base.py index 1cd05685a0..016be7ce93 100644 --- a/test/pylib/cpp/base.py +++ b/test/pylib/cpp/base.py @@ -22,6 +22,7 @@ from scripts import coverage as coverage_script from test import DEBUG_MODES, TEST_DIR, TOP_SRC_DIR, path_to from test.pylib.resource_gather import get_resource_gather from test.pylib.runner import BUILD_MODE, RUN_ID, TEST_SUITE +from test.pylib.scylla_cluster import merge_cmdline_options if TYPE_CHECKING: from collections.abc import Iterator, Sequence @@ -116,7 +117,7 @@ class CppFile(pytest.File, ABC): @cached_property def test_args(self) -> list[str]: - args = [*DEFAULT_SCYLLA_ARGS, *self.suite_config.get("extra_scylla_cmdline_options", [])] + args = merge_cmdline_options(DEFAULT_SCYLLA_ARGS, self.suite_config.get("extra_scylla_cmdline_options", [])) if x_log2_compaction_groups := self.config.getoption("--x-log2-compaction-groups"): if all_can_run_compaction_groups_except := self.suite_config.get("all_can_run_compaction_groups_except"): if self.test_name not in all_can_run_compaction_groups_except: diff --git a/test/pylib/runner.py b/test/pylib/runner.py index 2fc40ccfbb..ed9c5b9474 100644 --- a/test/pylib/runner.py +++ b/test/pylib/runner.py @@ -24,6 +24,7 @@ import xdist import yaml from test import ALL_MODES, DEBUG_MODES, TEST_RUNNER, TOP_SRC_DIR, TESTPY_PREPARED_ENVIRONMENT +from test.pylib.scylla_cluster import merge_cmdline_options from test.pylib.suite.base import ( SUITE_CONFIG_FILENAME, TestSuite, @@ -347,6 +348,11 @@ class TestSuiteConfig: if suite is None: suite = cls.from_pytest_node(node=node.parent) if suite: + extra_opts = node.config.getoption("--extra-scylla-cmdline-options") + if extra_opts: + extra_cmd = suite.cfg.get('extra_scylla_cmdline_options', []) + extra_cmd = merge_cmdline_options(extra_cmd, extra_opts.split()) + suite.cfg['extra_scylla_cmdline_options'] = extra_cmd node.stash[TEST_SUITE] = suite return suite