All tests in cql-pytest use a test keyspace created with the SimpleStrategy replication strategy. This was never intentional. We are recommending to users that they should use NetworkTopologyStrategy instead, and even want to deprecate SimpleStrategy (this is #8586), so tests should stop using SimpleStrategy and should start using the same strategy users would use in their applications - NetworkTopologyStrategy. Almost all tests are fixed by a single change in conftest.py which changes how "test_keyspace" is created. But additionally, tests in test_keyspace.py which explicitly create keyspaces (that's the point of that test file...) also had to be modified to use NetworkTopologyStrategy. Note that none of the tests relied on any special features or implementation details of SimpleStrategy. This patch is part of the bigger effort to remove reliance on SimpleStrategy from all tests, of all types - which we will need to do if we ever want to forbid SimpleStrategy by default. The issue of that effort: Refs #8638 Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20210620102341.195533-1-nyh@scylladb.com>
Single-node funtional tests for Scylla's CQL features. Tests use the Python CQL library and the pytest frameworks. By using an actual CQL library for the tests, they can be run against any implementation of CQL - both Scylla and Cassandra. Most tests - except in rare cases - should pass on both, to ensure that Scylla is compatible with Cassandra in most features.
To run all tests against an already-running local installation of Scylla
or Cassandra on localhost, just run pytest. The "--host" and "--port"
can be used to give a different location for the running Scylla or Cassanra.
The "--ssl" option can be used to use an encrypted (TLSv1.2) connection.
More conveniently, we have two scripts - "run" and "run-cassandra" - which do all the work necessary to start Scylla or Cassandra (respectively), and run the tests on them. The Scylla or Cassandra process is run in a temporary directory which is automatically deleted when the test ends.
Additional options can be passed to "pytest" or to "run" / "run-cassandra" to control which tests to run:
- To run all tests in a single file, do
pytest test_table.py. - To run a single specific test, do
pytest test_table.py::test_create_table_unsupported_names.
Additional useful pytest options, especially useful for debugging tests:
- -v: show the names of each individual test running instead of just dots.
- -s: show the full output of running tests (by default, pytest captures the test's output and only displays it if a test fails)