ClickHouse/tests/testflows/example/regression.py

46 lines
1.1 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
import os
import sys
from testflows.core import *
append_path(sys.path, "..")
from helpers.cluster import Cluster
from helpers.argparser import argparser
from platform import processor as current_cpu
@TestFeature
@Name("example")
@ArgumentParser(argparser)
def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None):
"""Simple example of how you can use TestFlows to test ClickHouse."""
nodes = {
"clickhouse": ("clickhouse1",),
}
self.context.clickhouse_version = clickhouse_version
if stress is not None:
self.context.stress = stress
folder_name = os.path.basename(current_dir())
if current_cpu() == "aarch64":
env = f"{folder_name}_env_arm64"
else:
env = f"{folder_name}_env"
with Cluster(
local,
clickhouse_binary_path,
nodes=nodes,
docker_compose_project_dir=os.path.join(current_dir(), env),
) as cluster:
self.context.cluster = cluster
Scenario(run=load("example.tests.example", "scenario"))
if main():
regression()