.gitlab-ci.yml updated v72

This commit is contained in:
Ivan Nikolaev-Axenov 2024-07-01 15:50:15 +03:00
parent f131f48dfe
commit 4a90d75cb3
8 changed files with 27 additions and 10 deletions

View file

@ -46,8 +46,8 @@ test:
paths: paths:
- /builds/mfd/clearing/clr_test/result-files - /builds/mfd/clearing/clr_test/result-files
script: script:
- apk update && apk add maven python3 - echo "Installing maven and python" && apk update && apk add maven python3
- cd clr_test - cd clr_test
- cp -r /builds/mfd/clearing/z-distr/target/clearing/bin ./clearing-all/bin - echo "Copying jar files to clearing-all/bin" && cp -r /builds/mfd/clearing/z-distr/target/clearing/bin ./clearing-all/bin
- cp /builds/mfd/clearing/z-distr/target/clearing/db/DDL.sql ./db - echo "Copying DDL.sql to db directory" && cp /builds/mfd/clearing/z-distr/target/clearing/db/DDL.sql ./db
- python3 run_test_docker_containers.py - python3 run_test_docker_containers.py

View file

@ -11,6 +11,7 @@ sleep 180
echo Run test case echo Run test case
sh ./clearing_testing_utils/run_test_env.sh sh ./clearing_testing_utils/run_test_env.sh
sleep 30
echo Run clearing-tester echo Run clearing-tester
sh ./clearing_testing_utils/clearing-tester/clearing-tester.sh sh ./clearing_testing_utils/clearing-tester/clearing-tester.sh

View file

@ -34,7 +34,12 @@ services:
- "7020:7020" - "7020:7020"
- "8080:8080" - "8080:8080"
volumes: volumes:
- test-files:/opt/clearing/clearing_testing_utils/store/results - /root/clr_test/mnt:/opt/clearing/files
- /root/clr_test/mnt/results:/opt/clearing/clearing_testing_utils/store/results
- /root/clr_test/mnt/logs/tester:/opt/clearing/clearing_testing_utils/clearing-tester/logs
- /root/clr_test/mnt/logs/converter:/opt/clearing/clearing_testing_utils/clearing-converter/logs
- /root/clr_test/mnt/logs/clearing:/opt/clearing/bin/log
- /root/clr_test/mnt/testFiles:/opt/clearing/clearing_testing_utils/store/results
# restart: always # restart: always
zookeeper: zookeeper:
@ -81,12 +86,6 @@ services:
volumes: volumes:
db: db:
driver: local driver: local
test-files:
driver: local
driver_opts:
type: none
o: bind
device: /root/clr_test/mnt/testFiles
zookeeper_data: zookeeper_data:
driver: local driver: local
kafka_data: kafka_data:

View file

View file

View file

View file

View file

@ -3,6 +3,10 @@ import re
import time import time
import shutil import shutil
import subprocess import subprocess
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
DATA_ROOT_DIR = os.environ['CLEARING_TEST_DIR'] DATA_ROOT_DIR = os.environ['CLEARING_TEST_DIR']
@ -26,16 +30,29 @@ def remove_files_with_extensions(extension):
for root, dirs, files in os.walk(CLR_TEST_DIR): for root, dirs, files in os.walk(CLR_TEST_DIR):
for currentFile in files: for currentFile in files:
if currentFile.lower().endswith(extension): if currentFile.lower().endswith(extension):
logging.info(f"Removing file {os.path.join(root, currentFile)}, based on extension {extension}")
os.remove(os.path.join(root, currentFile)) os.remove(os.path.join(root, currentFile))
def main(): def main():
folders = [i for i in sorted(os.listdir(DATA_ROOT_DIR)) if re.search("\\d{1,}.\\d{1,}.*", i)] folders = [i for i in sorted(os.listdir(DATA_ROOT_DIR)) if re.search("\\d{1,}.\\d{1,}.*", i)]
logging.info(f"Removing folder {CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/expected")
shutil.rmtree(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/expected") shutil.rmtree(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/expected")
logging.info(f"Removing folder {CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/input")
shutil.rmtree(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/input") shutil.rmtree(f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/store/input")
logging.info(f"Removing file {CLR_TEST_DIR}/db/export.sql")
os.remove(f"{CLR_TEST_DIR}/db/export.sql") os.remove(f"{CLR_TEST_DIR}/db/export.sql")
logging.info(f"Removing file {CLR_TEST_DIR}/db/test-data.sql")
os.remove(f"{CLR_TEST_DIR}/db/test-data.sql") os.remove(f"{CLR_TEST_DIR}/db/test-data.sql")
logging.info(f"Copying files from {DATA_ROOT_DIR}/{folders[0]}/db/ to {CLR_TEST_DIR}/db/")
shutil.copytree(f"{DATA_ROOT_DIR}/{folders[0]}/db/", f"{CLR_TEST_DIR}/db/", dirs_exist_ok=True) shutil.copytree(f"{DATA_ROOT_DIR}/{folders[0]}/db/", f"{CLR_TEST_DIR}/db/", dirs_exist_ok=True)
logging.info(f"Copying files from {DATA_ROOT_DIR}/{folders[0]}/clearing_testing_utils/ to {CLR_TEST_DIR}/clearing-all/clearing_testing_utils/")
shutil.copytree(f"{DATA_ROOT_DIR}/{folders[0]}/clearing_testing_utils/", f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/", dirs_exist_ok=True) shutil.copytree(f"{DATA_ROOT_DIR}/{folders[0]}/clearing_testing_utils/", f"{CLR_TEST_DIR}/clearing-all/clearing_testing_utils/", dirs_exist_ok=True)
remove_files_with_extensions(".xml") remove_files_with_extensions(".xml")
run_docker(folders[0], read_date(folders[0])) run_docker(folders[0], read_date(folders[0]))