Merge pull request #40876 from ClickHouse/tavplubix-patch-3

"Fix" database names collision in functional tests
This commit is contained in:
Alexander Tokmakov 2022-09-02 12:24:23 +03:00 committed by GitHub
commit 71dc70bdff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -533,7 +533,7 @@ class TestCase:
else: else:
# If --database is not specified, we will create temporary database with # If --database is not specified, we will create temporary database with
# unique name and we will recreate and drop it for each test # unique name and we will recreate and drop it for each test
def random_str(length=6): def random_str(length=8):
alphabet = string.ascii_lowercase + string.digits alphabet = string.ascii_lowercase + string.digits
# NOTE: it is important not to use default random generator, since it shares state. # NOTE: it is important not to use default random generator, since it shares state.
return "".join( return "".join(
@ -995,9 +995,12 @@ class TestCase:
args.timeout - (datetime.now() - start_time).total_seconds(), 20 args.timeout - (datetime.now() - start_time).total_seconds(), 20
) )
try: try:
drop_database_query = "DROP DATABASE " + database
if args.replicated_database:
drop_database_query += " ON CLUSTER test_cluster_database_replicated"
clickhouse_execute( clickhouse_execute(
args, args,
"DROP DATABASE " + database, drop_database_query,
timeout=seconds_left, timeout=seconds_left,
settings={ settings={
"log_comment": args.testcase_basename, "log_comment": args.testcase_basename,