mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Try to use random database name by default
This commit is contained in:
parent
30e4571c89
commit
496376a6bc
@ -53,6 +53,9 @@ def run_single_test(args, ext, server_logs_level, case_file, stdout_file, stderr
|
||||
while (datetime.now() - start_time).total_seconds() < args.timeout and proc.poll() is None:
|
||||
sleep(0.01)
|
||||
|
||||
os.system("sed -i 's/{test_db}/default/g' {file}".format(test_db=args.database, file=stdout_file))
|
||||
os.system("sed -i 's/{test_db}/default/g' {file}".format(test_db=args.database, file=stderr_file))
|
||||
|
||||
stdout = open(stdout_file, 'r').read() if os.path.exists(stdout_file) else ''
|
||||
stdout = unicode(stdout, errors='replace', encoding='utf-8')
|
||||
stderr = open(stderr_file, 'r').read() if os.path.exists(stderr_file) else ''
|
||||
@ -432,7 +435,7 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--testname', action='store_true', default=None, dest='testname', help='Make query with test name before test run')
|
||||
parser.add_argument('--hung-check', action='store_true', default=False)
|
||||
parser.add_argument('--force-color', action='store_true', default=False)
|
||||
parser.add_argument('--database', default='test', help='Default database for tests')
|
||||
parser.add_argument('--database', help='Database for tests (random name test_XXXXXX by default)')
|
||||
parser.add_argument('--parallel', default='1/1', help='One parallel test run number/total')
|
||||
parser.add_argument('-j', '--jobs', default=1, help='Run all tests in parallel', type=int) # default=multiprocessing.cpu_count()
|
||||
|
||||
@ -483,8 +486,14 @@ if __name__ == '__main__':
|
||||
args.client += ' --database=' + os.getenv("CLICKHOUSE_DATABASE")
|
||||
|
||||
args.client_with_database = args.client
|
||||
if args.database:
|
||||
args.client_with_database += ' --database=' + args.database
|
||||
if not args.database:
|
||||
def random_str(length=6):
|
||||
import random
|
||||
import string
|
||||
alphabet = string.ascii_lowercase + string.digits
|
||||
return ''.join(random.choice(alphabet) for _ in range(length))
|
||||
args.database = 'test_{suffix}'.format(suffix=random_str())
|
||||
args.client_with_database += ' --database=' + args.database
|
||||
|
||||
if args.extract_from_config is None:
|
||||
if os.access(args.binary + '-extract-from-config', os.X_OK):
|
||||
|
Loading…
Reference in New Issue
Block a user