2020-07-02 15:58:13 +00:00
|
|
|
#!/usr/bin/env python3
|
2021-05-07 13:14:40 +00:00
|
|
|
import os
|
2020-07-02 15:58:13 +00:00
|
|
|
import sys
|
|
|
|
from testflows.core import *
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
append_path(sys.path, "..")
|
2020-07-02 15:58:13 +00:00
|
|
|
|
|
|
|
from helpers.cluster import Cluster
|
|
|
|
from helpers.argparser import argparser
|
2022-02-11 01:08:41 +00:00
|
|
|
from platform import processor as current_cpu
|
2020-07-02 15:58:13 +00:00
|
|
|
|
|
|
|
@TestFeature
|
|
|
|
@Name("example")
|
|
|
|
@ArgumentParser(argparser)
|
2022-02-11 01:08:41 +00:00
|
|
|
def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None):
|
2020-07-02 15:58:13 +00:00
|
|
|
"""Simple example of how you can use TestFlows to test ClickHouse.
|
|
|
|
"""
|
|
|
|
nodes = {
|
|
|
|
"clickhouse": ("clickhouse1",),
|
|
|
|
}
|
2020-10-15 20:23:49 +00:00
|
|
|
|
2022-02-11 01:08:41 +00:00
|
|
|
self.context.clickhouse_version = clickhouse_version
|
|
|
|
|
2021-05-10 20:59:47 +00:00
|
|
|
if stress is not None:
|
|
|
|
self.context.stress = stress
|
|
|
|
|
2022-02-11 01:08:41 +00:00
|
|
|
folder_name = os.path.basename(current_dir())
|
|
|
|
if current_cpu() == 'aarch64':
|
|
|
|
env = f"{folder_name}_env_arm64"
|
|
|
|
else:
|
|
|
|
env = f"{folder_name}_env"
|
|
|
|
|
2021-05-07 13:14:40 +00:00
|
|
|
with Cluster(local, clickhouse_binary_path, nodes=nodes,
|
2022-02-11 01:08:41 +00:00
|
|
|
docker_compose_project_dir=os.path.join(current_dir(), env)) as cluster:
|
2020-07-02 15:58:13 +00:00
|
|
|
self.context.cluster = cluster
|
|
|
|
|
|
|
|
Scenario(run=load("example.tests.example", "scenario"))
|
|
|
|
|
|
|
|
if main():
|
|
|
|
regression()
|