fix stress test script

This commit is contained in:
Max Kainov 2024-11-22 12:41:49 +01:00
parent 81db019d9a
commit 279d79ed6c
3 changed files with 15 additions and 8 deletions

View File

@ -23,6 +23,7 @@ from typing import (
from build_download_helper import APIException, get_gh_api
from ci_config import CI
from ci_utils import Shell
from env_helper import (
GITHUB_JOB,
GITHUB_REPOSITORY,
@ -416,10 +417,11 @@ class JobReport:
exit_code: int = -1
def to_praktika_result(self, job_name):
sys.path.append("./ci")
# ugly WA to exclude ci.py file form import
Shell.check("mkdir -p /tmp/praktika/")
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(current_dir + "/../../ci")
sys.path.append(current_dir + "/../../")
if current_dir in sys.path:
sys.path.remove(current_dir)
from praktika.result import ( # pylint: disable=import-error,import-outside-toplevel
@ -515,6 +517,12 @@ class JobReport:
to_file = to_file or JOB_REPORT_FILE
with open(to_file, "w", encoding="utf-8") as json_file:
json.dump(asdict(self), json_file, default=path_converter, indent=2)
# temporary WA to ease integration with praktika
check_name = os.getenv("CHECK_NAME", "")
if check_name:
self.to_praktika_result(job_name=check_name).dump()
return self

View File

@ -9,9 +9,8 @@ import sys
from pathlib import Path
from typing import List, Tuple
from praktika.utils import Shell # pylint: disable=import-error
from build_download_helper import download_all_deb_packages
from ci_utils import Shell
from clickhouse_helper import CiLogsCredentials
from docker_images_helper import DockerImage, get_docker_image, pull_image
from env_helper import REPO_COPY, REPORT_PATH, TEMP_PATH
@ -156,8 +155,6 @@ def run_stress_test(upgrade_check: bool = False) -> None:
pr_info = PRInfo()
docker_image = pull_image(get_docker_image("clickhouse/stateful-test"))
packages_path = temp_path / "packages"
packages_path.mkdir(parents=True, exist_ok=True)
@ -167,8 +164,10 @@ def run_stress_test(upgrade_check: bool = False) -> None:
assert Shell.check(
f"cp /tmp/praktika/input/*.deb {packages_path}", verbose=True
)
docker_image = pull_image(get_docker_image("clickhouse/stateful-test"))
else:
download_all_deb_packages(check_name, reports_path, packages_path)
docker_image = pull_image(get_docker_image("clickhouse/stress-test"))
server_log_path = temp_path / "server_log"
server_log_path.mkdir(parents=True, exist_ok=True)
@ -218,7 +217,7 @@ def run_stress_test(upgrade_check: bool = False) -> None:
start_time=stopwatch.start_time_str,
duration=stopwatch.duration_seconds,
additional_files=additional_logs,
).dump().to_praktika_result(job_name=f"Stress tests ({check_name})").dump()
).dump()
if state == "failure":
sys.exit(1)

View File

@ -21,7 +21,7 @@ while [[ "$#" -gt 0 ]]; do
--fast-test) FAST_TEST=1 ;;
--s3-storage) EXPORT_S3_STORAGE_POLICIES=1 ;;
--no-azure) NO_AZURE=1 ;;
*) echo "Unknown option: $1" ;;
*) echo "Unknown option: $1" ; exit 1 ;;
esac
shift
done