in906700d5, we accepted 0 as well as the return code of "nodetool <command> --help", because we needed to be prepared for the newer seastar submodule while be compatible with the older seastar versions. now that in305f1bd3, we bumped up the seastar module, and this commit picked up the change to return 0 when handling "--help" command line option in seastar, we are able to drop the workaround. so, in this change, we only use "0" as the expected return code. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com> Closes scylladb/scylladb#18627
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
#
|
|
# Copyright 2023-present ScyllaDB
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
#
|
|
|
|
import pytest
|
|
from rest_api_mock import expected_request
|
|
import subprocess
|
|
|
|
import utils
|
|
|
|
|
|
# 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":
|
|
utils.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):
|
|
utils.check_nodetool_fails_with(
|
|
nodetool,
|
|
("help", "compact", "foo", "bar"),
|
|
{},
|
|
["error: too many positional options have been specified on the command line"])
|
|
|
|
|
|
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
|