Check that functional tests cleanup their tables

This commit is contained in:
Alexey Milovidov 2023-07-09 03:55:25 +02:00
parent ab93967fb4
commit de0837fe21
2 changed files with 20 additions and 1 deletions

View File

@ -1212,7 +1212,20 @@ class TestCase:
seconds_left = max(
args.timeout - (datetime.now() - start_time).total_seconds(), 20
)
drop_database_query = "DROP DATABASE IF EXISTS " + database
leftover_tables = clickhouse_execute(
args,
f"SHOW TABLES FROM {database}",
timeout=seconds_left,
settings={
"log_comment": args.testcase_basename,
},
).decode().replace("\n", ", ");
if 0 != len(leftover_tables):
raise Exception(f"The test should cleanup its tables ({leftover_tables}), otherwise it is inconvenient for running it locally.")
drop_database_query = f"DROP DATABASE IF EXISTS {database}"
if args.replicated_database:
drop_database_query += " ON CLUSTER test_cluster_database_replicated"

View File

@ -1,3 +1,6 @@
DROP TABLE IF EXISTS session_events;
DROP TABLE IF EXISTS event_types;
CREATE TABLE session_events
(
clientId UInt64,
@ -75,3 +78,6 @@ FROM
WHERE runningDifference(timestamp) >= 500
ORDER BY timestamp ASC
FORMAT Null;
DROP TABLE session_events;
DROP TABLE event_types;