Files
scylladb/test/nodetool/test_logging.py
Botond Dénes 8f3b1db37f test/nodetool: nodetool(): return res object instead of just stdout
So callers have access to stderr, return code and more.
This causes some churn in the test, but the changes are mechanical.
2024-03-27 04:18:19 -04:00

43 lines
1.5 KiB
Python

#
# Copyright 2023-present ScyllaDB
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
from rest_api_mock import expected_request
import utils
def test_getlogginglevels(nodetool):
res = nodetool("getlogginglevels", expected_requests=[
expected_request("GET", "/storage_service/logging_level",
response=[{"key": "sstable", "value": "info"}, {"key": "cache", "value": "trace"}])])
assert res.stdout == \
"""
Logger Name Log Level
sstable info
cache trace
"""
def test_setlogginglevel(nodetool):
nodetool("setlogginglevel", "wasm", "trace", expected_requests=[
expected_request("POST", "/system/logger/wasm", params={"level": "trace"})])
def test_setlogginglevel_reset_logger(nodetool, scylla_only):
utils.check_nodetool_fails_with(
nodetool,
("setlogginglevel", "wasm"),
{"expected_requests": []},
["error processing arguments: resetting logger(s) is not supported yet, the logger and level parameters are required"])
def test_setlogginglevel_reset_all_loggers(nodetool, scylla_only):
utils.check_nodetool_fails_with(
nodetool,
("setlogginglevel",),
{"expected_requests": []},
["error processing arguments: resetting logger(s) is not supported yet, the logger and level parameters are required"])