Files
scylladb/test/nodetool/test_help.py
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

54 lines
1.7 KiB
Python

#
# Copyright 2023-present ScyllaDB
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
#
from test.nodetool.rest_api_mock import expected_request
from test.nodetool.utils import check_nodetool_fails_with
# These are simple smoke tests, because automatically testing help is next to impossible.
def test_help(nodetool):
res = nodetool("help", expected_requests=[
# These requests are sometimes sent by Cassandra nodetool when invoking help
# This looks like a new connection to JMX.
expected_request("GET", "/column_family/", response=[], multiple=expected_request.ANY),
expected_request("GET", "/stream_manager/", response=[], multiple=expected_request.ANY),
])
assert res.stdout
def test_help_command(nodetool):
res = nodetool("help", "version")
assert res.stdout
def test_help_nonexistent_command(request, nodetool):
if request.config.getoption("nodetool") == "scylla":
check_nodetool_fails_with(
nodetool,
("help", "foo",),
{},
["error processing arguments: unknown command foo"])
else:
res = nodetool("help", "foo")
assert res.stdout == "Unknown command foo\n\n"
def test_help_command_too_many_args(nodetool, scylla_only):
check_nodetool_fails_with(
nodetool,
("help", "compact", "foo", "bar"),
{},
["error processing arguments: unknown command compact foo bar"])
def test_help_consistent(nodetool, scylla_only):
for command in ("version", "compact", "settraceprobability"):
res1 = nodetool("help", command)
res2 = nodetool(command, "--help")
assert res1.stdout == res2.stdout