mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
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.
This commit is contained in:
2
test.py
2
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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user