From 84748a8dcb4931258c5b9ef0cb3a32b9f2b9202b Mon Sep 17 00:00:00 2001 From: Andrea Barbadoro Date: Fri, 10 May 2024 17:46:57 +0200 Subject: [PATCH] tests/log_level_test: test_log_level_persist_a_never_expire_request test that set log-level admin_api_server trace 10 set log-level admin_api_server error 0 never resets the logger to the info level --- tests/rptest/tests/log_level_test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/rptest/tests/log_level_test.py b/tests/rptest/tests/log_level_test.py index 1c88c3b76879..d0ff84908363 100644 --- a/tests/rptest/tests/log_level_test.py +++ b/tests/rptest/tests/log_level_test.py @@ -129,6 +129,33 @@ def test_log_level_multiple_expiry(self, loggers=tuple[str, str]): backoff_sec=1, err_msg=f"Never saw Expiring for {second_logger}") + @cluster(num_nodes=1) + def test_log_level_persist_a_never_expire_request(self): + """ + check that this sequence of actions + set log-level admin_api_server trace 10 + set log-level admin_api_server error 0 + + never resets the logger to the info level + """ + admin = Admin(self.redpanda) + node = self.redpanda.nodes[0] + + with self.redpanda.monitor_log(node) as mon: + admin.set_log_level("admin_api_server", "trace", expires=10) + time.sleep(1) + admin.set_log_level("admin_api_server", "error", expires=0) + + try: + mon.wait_until("Expiring log level for {admin_api_server}", + timeout_sec=15, + backoff_sec=1) + assert False, "Should not have seen message" + except ducktape.errors.TimeoutError: + pass + + level = admin.get_log_level("admin_api_server")[0]["level"] + assert level == "error", f"expected level=error, got {level=}" @cluster(num_nodes=3) def test_max_expiry(self):