In this patch, we port validation/entities/secondary_index_test.java, resulting in 41 tests for various aspects of secondary indexes. Some of the original Java tests required direct access to the Cassandra internals not available through CQL, so those tests were omitted. In porting these tests, I uncovered 9 previously-unknown bugs in Scylla: Refs #8600: IndexInfo system table lists MV name instead of index name Refs #8627: Cleanly reject updates with indexed values where value > 64k Refs #8708: Secondary index is missing partitions with only a static row Refs #8711: Finding or filtering with an empty string with a secondary index seems to be broken Refs #8714: Improve error message on unsupported restriction on partition key Refs #8717: Recent fix accidentally broke CREATE INDEX IF NOT EXISTS Refs #8724: Wrong error message when attempting index of UDT column with a duration Refs #8744: Index-creation error message wrongly refers to "map" - it can be any collection Refs #8745: Secondary index CREATE INDEX syntax is missing the "values" option These tests also provide additional reproducers for already known issues: Refs #2203: Add support for SASI Refs #2962: Collection column indexing Refs #2963: Static column indexing Refs #4244: Add support for mixing token, multi- and single-column restrictions Due to these bugs, 15 out of the 41 tests here currently xfail. We actually had more failing tests, but we fixed a few of the above issues before this patch went in, so their tests are passing at the time of this submission. All 41 tests pass when running against Cassandra. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20210531112354.970028-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.
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)