mirror of https://github.com/ByConity/ByConity
run stress tests with Atomic database
This commit is contained in:
parent
0f1c4bc9c4
commit
a5d74c44f1
|
@ -24,20 +24,26 @@ def run_perf_test(cmd, xmls_path, output_folder):
|
|||
return p
|
||||
|
||||
|
||||
def get_options(i):
|
||||
options = ""
|
||||
if 0 < i:
|
||||
options += " --order=random"
|
||||
if i == 1:
|
||||
options += " --atomic-db-engine"
|
||||
return options
|
||||
|
||||
|
||||
def run_func_test(cmd, output_prefix, num_processes, skip_tests_option):
|
||||
skip_list_opt = get_skip_list_cmd(cmd)
|
||||
output_paths = [os.path.join(output_prefix, "stress_test_run_{}.txt".format(i)) for i in range(num_processes)]
|
||||
f = open(output_paths[0], 'w')
|
||||
main_command = "{} {} {}".format(cmd, skip_list_opt, skip_tests_option)
|
||||
logging.info("Run func tests main cmd '%s'", main_command)
|
||||
pipes = [Popen(main_command, shell=True, stdout=f, stderr=f)]
|
||||
for output_path in output_paths[1:]:
|
||||
time.sleep(0.5)
|
||||
f = open(output_path, 'w')
|
||||
full_command = "{} {} --order=random {}".format(cmd, skip_list_opt, skip_tests_option)
|
||||
pipes = []
|
||||
for i in range(0, len(output_paths)):
|
||||
f = open(output_paths[i], 'w')
|
||||
full_command = "{} {} {} {}".format(cmd, skip_list_opt, get_options(i), skip_tests_option)
|
||||
logging.info("Run func tests '%s'", full_command)
|
||||
p = Popen(full_command, shell=True, stdout=f, stderr=f)
|
||||
pipes.append(p)
|
||||
time.sleep(0.5)
|
||||
return pipes
|
||||
|
||||
|
||||
|
|
|
@ -49,6 +49,10 @@ def remove_control_characters(s):
|
|||
s = re.sub(r"[\x00-\x08\x0b\x0e-\x1f\x7f]", "", s)
|
||||
return s
|
||||
|
||||
def get_db_engine(args):
|
||||
if args.atomic_db_engine:
|
||||
return " ENGINE=Atomic"
|
||||
return ""
|
||||
|
||||
def run_single_test(args, ext, server_logs_level, client_options, case_file, stdout_file, stderr_file):
|
||||
|
||||
|
@ -69,7 +73,7 @@ def run_single_test(args, ext, server_logs_level, client_options, case_file, std
|
|||
database = 'test_{suffix}'.format(suffix=random_str())
|
||||
|
||||
clickhouse_proc_create = Popen(shlex.split(args.client), stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
clickhouse_proc_create.communicate("CREATE DATABASE " + database)
|
||||
clickhouse_proc_create.communicate("CREATE DATABASE " + database + get_db_engine(args))
|
||||
|
||||
os.environ["CLICKHOUSE_DATABASE"] = database
|
||||
|
||||
|
@ -507,10 +511,10 @@ def main(args):
|
|||
|
||||
if args.database and args.database != "test":
|
||||
clickhouse_proc_create = Popen(shlex.split(args.client), stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
clickhouse_proc_create.communicate("CREATE DATABASE IF NOT EXISTS " + args.database)
|
||||
clickhouse_proc_create.communicate("CREATE DATABASE IF NOT EXISTS " + args.database + get_db_engine(args))
|
||||
|
||||
clickhouse_proc_create = Popen(shlex.split(args.client), stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
clickhouse_proc_create.communicate("CREATE DATABASE IF NOT EXISTS test")
|
||||
clickhouse_proc_create.communicate("CREATE DATABASE IF NOT EXISTS test" + get_db_engine(args))
|
||||
|
||||
def is_test_from_dir(suite_dir, case):
|
||||
case_file = os.path.join(suite_dir, case)
|
||||
|
@ -722,6 +726,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument('-r', '--server-check-retries', default=30, type=int, help='Num of tries to execute SELECT 1 before tests started')
|
||||
parser.add_argument('--skip-list-path', help="Path to skip-list file")
|
||||
parser.add_argument('--use-skip-list', action='store_true', default=False, help="Use skip list to skip tests if found")
|
||||
parser.add_argument('--atomic-db-engine', action='store_true', help='Create databases with Atomic engine by default')
|
||||
|
||||
parser.add_argument('--no-stateless', action='store_true', help='Disable all stateless tests')
|
||||
parser.add_argument('--no-stateful', action='store_true', help='Disable all stateful tests')
|
||||
|
|
Loading…
Reference in New Issue