Any empty object of the json::json_list type has its internal _set variable assigned to false which results in such objects being skipped by the json::json_builder. Hence, the json returned by the api GET//compaction_manager/compaction_history does not contain the field `rows_merged` if a cell in the system.compaction_history table is null or an empty list. In such cases, executing the command `nodetool compactionhistory` will result in a crash with the following error message: `error running operation: rjson::error (JSON assert failed on condition 'false'` The patch fixes it by checking if the json object contains the `rows_merged` element before processing. If the element does not exist, the nodetool will now produce an empty list. Fixes https://github.com/scylladb/scylladb/issues/23540 Closes scylladb/scylladb#23514
Front-end tests for nodetool
The tests in this directory exercise the nodetool client itself, mocking the API backend. This allows for testing all combinations of all supported options, and still keeping the tests quick.
The tests can be run against both the scylla-native nodetool (default), or the inherited, C*-based nodetool.
Run all tests against the scylla-native nodetool:
pytest --nodetool=scylla .
You can specify the path to the scylla binary with the --nodetool-path option. By default the tests will pick up the ScyllaDB executable, that is appropriate for the --mode option (defaults to dev).
Run all tests against the C* nodetool:
pytest --nodetool=cassandra .
Again, you can specify the path to the nodetool binary with --nodetool-path option. By default, <scylladb.git>/tools/java/bin/nodetool will be used.
When running the test against the java-nodeotol, you can specify the path to JMX with --jmx-path option. By default, <scylladb.git>/tools/jmx/scripts/scylla-jmx will be used.
If you add new tests, make sure to run all tess against both nodetool implementations, to avoid regressions. Note that CI/promotion will only run the tests against the scylla-native nodetool.