mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-28 18:50:53 +00:00
After all test suites migrated to test_config.yaml with type: Python, the specialized suite classes (Topology, CQLApproval, Run, Tool) and the legacy execution pipeline (find_tests, run_test, TestSuite.run, Test.run) became unreachable. Remove all this dead code. Deleted files: - suite/topology.py, suite/cql_approval.py, suite/run.py, suite/tool.py Simplified: - base.py: remove run_test(), read_log(), TestSuite.run(), add_test_list(), build_test_list(), all_tests(), test_count(), SUITE_CONFIG_FILENAME, disabled/flaky test tracking, and dead Test attributes (args, core_args, valid_exit_codes, allure_dir, is_flaky, is_cancelled, etc.) - python.py: remove PythonTestSuite.run(), PythonTest.run(), _prepare_pytest_params(), pattern, test_file_ext, xmlout, server_log, scylla_env setup, and shlex import. Simplify run_ctx() to take no parameters. - runner.py: remove --scylla-log-filename option, print_scylla_log_filename fixture, SUITE_CONFIG_FILENAME import, and suite.yaml probe in TestSuiteConfig.from_pytest_node(). - __init__.py: remove re-exports of deleted classes. - test_config.yaml: Topology -> Python, Approval -> Python. - conftest files: run_ctx(options=...) -> run_ctx(). - docs/dev/testing.md: update to reflect current pytest-based architecture, log paths, and removed features. Co-Authored-By: Claude Opus 4.6 (200K context) <noreply@anthropic.com> Closes scylladb/scylladb#29613
75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
# Copyright 2022-present ScyllaDB
|
|
#
|
|
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
|
"""Conftest for Scylla GDB tests"""
|
|
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from test.pylib.suite.python import PythonTest
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
async def scylla_server(testpy_test: PythonTest | None):
|
|
"""Return a running Scylla server instance from the active test cluster."""
|
|
async with testpy_test.run_ctx() as cluster:
|
|
yield next(iter(cluster.running.values()))
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def gdb_cmd(scylla_server, request):
|
|
"""
|
|
Returns a command-line (argv list) that attaches to the `scylla_server` PID, loads `scylla-gdb.py`
|
|
and `gdb_utils.py`. This is meant to be executed by `execute_gdb_command()` in `--batch` mode.
|
|
"""
|
|
scylla_gdb_py = os.path.join(request.fspath.dirname, "..", "..", "scylla-gdb.py")
|
|
script_py = os.path.join(request.fspath.dirname, "gdb_utils.py")
|
|
cmd = [
|
|
"gdb",
|
|
"-q",
|
|
"--batch",
|
|
"--nx",
|
|
"-se",
|
|
str(scylla_server.exe),
|
|
"-p",
|
|
str(scylla_server.cmd.pid),
|
|
"-ex",
|
|
"set python print-stack full",
|
|
"-x",
|
|
scylla_gdb_py,
|
|
"-x",
|
|
script_py,
|
|
]
|
|
return cmd
|
|
|
|
|
|
def execute_gdb_command(gdb_cmd, scylla_command: str = None, full_command: str = None):
|
|
"""Execute a single GDB command attached to the running Scylla process.
|
|
|
|
Builds on `gdb_cmd` and runs GDB via `subprocess.run()` in `--batch` mode.
|
|
`scylla_command` is executed as `scylla <cmd>` through GDB's Python interface.
|
|
|
|
Args:
|
|
gdb_cmd: Base GDB argv list returned by the `gdb_cmd` fixture.
|
|
scylla_command: Scylla GDB command name/args (from scylla-gdb.py). Mutually exclusive with `full_command`.
|
|
full_command: Raw GDB command string to execute. Mutually exclusive with `scylla_command`.
|
|
|
|
Returns:
|
|
Command stdout as a decoded string.
|
|
"""
|
|
if full_command:
|
|
command = [*gdb_cmd, "-ex", full_command]
|
|
else:
|
|
command = [
|
|
*gdb_cmd,
|
|
"-ex",
|
|
f"python gdb.execute('scylla {scylla_command}')",
|
|
]
|
|
|
|
result = subprocess.run(
|
|
command, capture_output=True, text=True, encoding="utf-8", errors="replace"
|
|
)
|
|
return result
|