Skip to content

Commit 892d281

Browse files
committed
Extra diagnostics on test failure
1 parent 40055d9 commit 892d281

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/clickhouse-test

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,12 +1894,20 @@ class TestCase:
18941894
description_full += "Database: " + self.testcase_args.testcase_database
18951895

18961896
if result.status == TestStatus.FAIL:
1897+
def query(q_str : str):
1898+
return "f{args.client} -q '{q_str}'"
1899+
18971900
for description, command in [
1898-
("OS info", "lsb_release -idrc"),
1901+
# ("OS info", "lsb_release -idrc"),
18991902
("disk usage", "df -h"),
19001903
("RAM usage", "free -h"),
19011904
# ("child processes", ("ps -f -g ", {'env' : {"LIBPROC_HIDE_KERNEL" : "1"}})),
1902-
("ALL processes", ("ps xj", {'env' : {"LIBPROC_HIDE_KERNEL" : "1"}})),
1905+
# ("ALL processes", ("ps xj", {'env' : {"LIBPROC_HIDE_KERNEL" : "1"}})),
1906+
("system parameters", "sysctl -a"),
1907+
("CH Databases", query("SHOW DATABASES")),
1908+
("CH Warnings", query("SELECT * FROM system.warnings")),
1909+
("CH Open sessions", query("SELECT event_time, client_address, client_port, interface, user, auth_type FROM system.session_log WHERE type == 'LoginSuccess' AND auth_id NOT IN (SELECT auth_id FROM system.session_log WHERE type == 'Logout') ORDER BY event_time")),
1910+
("CH Metrics", query("SELECT metric, value FROM system.metrics WHERE value != 0"))
19031911
]:
19041912
try:
19051913
if isinstance(command, str):
@@ -1910,7 +1918,7 @@ class TestCase:
19101918
except Exception as e:
19111919
print(f"Failed to execute post-failure command '{command}', got exception: {e}")
19121920
else:
1913-
description_full += f"\n{description} :\n{output.decode('utf-8')}"
1921+
description_full += f"\n{description}:\n{command}\n\n{output.decode('utf-8')}"
19141922

19151923
result.description = description_full
19161924
return result

0 commit comments

Comments
 (0)