Commit Graph

7 Commits

Author SHA1 Message Date
Botond Dénes
764e9a344d test/nodetool: nodetool(): add check_return_code param
When set to false, the returncode is not checked, this is left to the
caller. This in turn allows for checking the expected and unexpected
requests which is not checked when the nodetool process fails.
This is used by utils._do_check_nodetool_fails_with(), so that expected
and unexpected requests are checked even for failed invocations.

Some test need adjustment to the stricter checks.
2024-03-27 04:18:19 -04:00
Kefu Chai
4d8f74f301 test/nodetool: move format_size into utils.py
so that this helper can be shared across more tests. `test_info.py`
will be using it as well.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-02-26 14:52:22 +08:00
Kefu Chai
3574c22d73 test/nodetool/utils: print out unmatched output on test failure
would be more helpful if the matched could print out the unmatched
output on test failure. so, in this change, both stdout and stderr
are printed if they fail to match with the expected error.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#17489
2024-02-23 08:20:30 +02:00
Botond Dénes
48e8435466 test/nodetool: utils: add check_nodetool_fails_with_error_contains()
Checks that at least one error snippet is contained in the error output.
2024-02-16 04:40:31 -05:00
Botond Dénes
190c9a7239 test/nodetool: util: replace flags with custom matcher
_do_check_nodetool_fails_with() currently has a `match_all` flag to
control how the match is checked. Now we need yet another way to control
how matching is done. Instead of adding yet another flag (and who knows
how many more), jut replace the flag and the errors input with a matcher
functor, which gets the stdout and stderr and is delegated to do any
checks it wants. This method will scale much better going forward.
2024-02-16 04:40:31 -05:00
Botond Dénes
d4f7f23b98 test/nodetool: util.py: add check_nodetool_fails_with_all()
Similar to the existing check_nodetool_fails_with() but checks that all
error messages from expected_errors are contained in stderr.

While at it, use list as the typing hint, instead of typing.List.
2024-02-08 09:20:25 -05:00
Botond Dénes
5ad9b1424c test/nodetool: introduce utils.check_nodetool_fails_with()
Checking that nodetool fails with a given message turned out to be a
common pattern, so extract the logic for checking this into a method of
its own. Refactor the existing tests to use it, instead of the
hand-coded equivalent.
2023-10-04 05:27:09 -04:00