Files
scylladb/test/rest_api
Nadav Har'El 024ecd45a2 test/rest_api: add reproducer for REST API JSON encoding bug
This patch adds a reproducer for the JSON encoding in issue #9061.
The bug was already fixed (it was a Seastar bug, and Seastar was
updated in commit 5d4213e1b8), but
I verified that the test fails before that patch - and passes today.

It is useful to have such a test for regressions, as well as for
testing backports.

Unfortunately, the test isn't pretty. The test uses the toppartitions
API, which instead of having a "start" and "stop" request has a single
synchronous "start for a given duration" request, and we need to run
it with some fixed duration (we took 1 second), and in parallel, one
request.

Refs #9061.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20220323180855.3307931-1-nyh@scylladb.com>
2022-03-28 15:28:45 +03:00
..
2021-12-08 16:05:33 +02:00
2021-12-08 16:05:33 +02:00
2022-01-02 15:53:25 +02:00
2021-12-08 16:05:33 +02:00

Tests for the Scylla REST API.

Tests use the requests library and the pytest frameworks (both are available from Linux distributions, or with "pip install").

To run all tests using test.py, just run ./test.py api/run.

To run all tests against an already-running local installation of Scylla, just run pytest. The "--host" and "--api-port" can be used to give a different location for the running Scylla.

More conveniently, we have a script - "run" - which does all the work necessary to start Scylla, and run the tests on it. The Scylla process is run in a temporary directory which is automatically deleted when the test ends.

"run" automatically picks the most recently compiled version of Scylla in build/*/scylla - but this choice of Scylla executable can be overridden with the SCYLLA environment variable.

Additional options can be passed to "pytest" or to "run" to control which tests to run:

  • To run all tests in a single file, do pytest test_system.py.
  • To run a single specific test, do pytest test_system.py::test_system_uptime_ms.
  • To run the same test or tests 100 times, add the --count=100 option. This is faster than running run 100 times, because Scylla is only run once, and also counts for you how many of the runs failed. For pytest to support the --count option, you need to install a pytest extension: pip install pytest-repeat

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)