test cases validator added

This commit is contained in:
Ivan Nikolaev-Axenov 2025-06-03 11:20:07 +03:00
parent 28b5ef8b4b
commit f50637e611
4 changed files with 19 additions and 11 deletions

View file

@ -17,7 +17,7 @@ preflight:
stage: preflight
script:
- pwd
- git clone -b successful_set_with_df01_renamed "http://gitlab-ci-token:$ACCESS_TOKEN@git.mfd.msk/mfd/clearing_test.git"
- git clone -b only_final "http://gitlab-ci-token:$ACCESS_TOKEN@git.mfd.msk/mfd/clearing_test.git"
artifacts:
name: "$CI_COMMIT_REF_NAME"
expire_in: 1 day
@ -59,8 +59,9 @@ test:
- python3 clr_test/run_test_docker_containers.py
- echo "Copying logs" && mkdir -p artifacts/logs && docker run --rm -v clr_test_logs_volume:/logs alpine tar -C /logs -cf - . | tar -C artifacts/logs -xf -
- echo "Cleaning up log volume" && docker volume rm clr_test_logs_volume
- cat clr_test/results.txt && ! grep -q "failed" clr_test/results.txt
artifacts:
expire_in: 1 day
expire_in: 7 day
when: always
paths:
- artifacts/logs

View file

@ -131,8 +131,8 @@ fi
if [ "$TESTER_EXIT_CODE" -eq "0" ]
then
echo "Test case ${CLR_TEST_NAME} passed successfully"
exit 0
else
echo "Test case ${CLR_TEST_NAME} failed"
exit 1
fi
exit 0

View file

@ -35,10 +35,9 @@ services:
condition: service_started
volumes:
- logs_volume:/opt/clearing/bin/log_artifacts
# restart: always
zookeeper:
image: mirror.gcr.io/confluentinc/cp-zookeeper:6.2.3.amd64
image: mirror.gcr.io/confluentinc/cp-zookeeper
container_name: zookeeper
environment:
ZOOKEEPER_SERVER_ID: 1
@ -46,7 +45,7 @@ services:
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: mirror.gcr.io/confluentinc/cp-kafka:6.2.3.amd64
image: mirror.gcr.io/confluentinc/cp-kafka
container_name: kafka
environment:
KAFKA_BROKER_ID: 1

View file

@ -50,9 +50,6 @@ def run_docker(folder_name: str) -> int:
os.chdir("..")
if code != 0:
sys.exit(code)
return code
@ -91,6 +88,14 @@ def copy_directory(path_from: str, path_to: str) -> None:
shutil.copytree(path_from, path_to, dirs_exist_ok=True)
def append_to_log_file(test_case: str, code: int) -> None:
with open("clr_test/results.txt", 'a') as f:
if code == 0:
f.write(f"Test case {test_case} passed successfully\n")
else:
f.write(f"Test case {test_case} failed\n")
def apply_test_case(folder: str) -> None:
remove_directory(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/expected")
remove_directory(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/input")
@ -103,7 +108,8 @@ def apply_test_case(folder: str) -> None:
remove_files_with_extensions(".xml")
# change_date(folder)
run_docker(folder)
exit_code = run_docker(folder)
append_to_log_file(folder, exit_code)
def stop_docker_compose() -> None:
@ -151,6 +157,8 @@ def combine_ddl_updates_into_file():
def main() -> None:
folders = [i for i in sorted(os.listdir(DATA_ROOT_DIR)) if re.search("\\d{1,}.\\d{1,}.*", i)]
remove_if_exists("clr_test/results.txt")
combine_ddl_updates_into_file()
for folder in folders:
stop_docker_compose()