Add possibility to run topology tests using bare pytest command. To achieve this goal the following changes were made: - Add fixtures `testpy_testsuite` and `testpy_test` to `test/conftest.py`. - To build `TestSuite` object we need to discover a corresponding `suite.xml` file. Do this by walking up thru the fs tree starting from the current test file. - Run ScyllaClusterManager using pytest fixture if `--manager-api` option is not provided. And made some refactoring: - Add path constants to `test` module and use them in different test suites instead of own dups of the same code: - TOP_SRC_DIR : ScyllaDB's source code root directory - TEST_DIR : the directory with test.py tests and libs - BUILD_DIR : directory with ScyllaDB's build artifacts - Add TestSuite.log_dir attribute as a ScyllaDB's build mode subdir of a path provided using `--tmpdir` CLI argument. Don't use `tmpdir` name because it mixed up with pytest's built-in fixture and `--tmpdir` option itself. - Change default value for `--tmdir` from `./testlog` to `TOP_SRC_DIR/testlog` - Refactor `ResourceGather*` classes to use path from a `test` object instead of providing it separately. - Move modes constants (`all_modes`/`ALL_MODES` and `debug_modes`/`DEBUG_MODES`) to `test` module and remove duplication. - Move `prepare_dirs()` and `start_3rd_party_services()` from `pylib.util` to`pylib.suite.base` to avoid circular imports. - In some places refactor to use f-strings for formatting. Also minor changes related to running with pytest-xdist: - When run tests in parallel we need to ensure that filenames are unique by adding xdist worker ID to them. - Pass random seed across xdist workers using env variable. Closes scylladb/scylladb#22960 * github.com:scylladb/scylladb: test.py: async_cql: remove unused event_loop fixture test.py: random_failures: make it play well with xdist test.py: add xdist worker ID to log filenames test.py: topology: run tests using bare pytest command test.py: add fixtures for current test suite and test test.py: refactor paths constants and options
Scylla in-source tests.
For details on how to run the tests, see docs/dev/testing.md
Shared C++ utils, libraries are in lib/, for Python - pylib/
alternator - Python tests which connect to a single server and use the DynamoDB API unit, boost, raft - unit tests in C++ cqlpy - Python tests which connect to a single server and use CQL topology* - tests that set up clusters and add/remove nodes cql - approval tests that use CQL and pre-recorded output rest_api - tests for Scylla REST API Port 9000 scylla-gdb - tests for scylla-gdb.py helper script nodetool - tests for C++ implementation of nodetool
If you can use an existing folder, consider adding your test to it. New folders should be used for new large categories/subsystems, or when the test environment is significantly different from some existing suite, e.g. you plan to start scylladb with different configuration, and you intend to add many tests and would like them to reuse an existing Scylla cluster (clusters can be reused for tests within the same folder).
To add a new folder, create a new directory, and then
copy & edit its suite.ini.