From 6c351786bff41a0f14caeb620befc8391c5b4d20 Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 28 Oct 2024 14:02:30 +0100 Subject: [PATCH 1/2] test_: unique project per run --- _assets/scripts/run_functional_tests.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/_assets/scripts/run_functional_tests.sh b/_assets/scripts/run_functional_tests.sh index 24f2c931025..4d5d18264d0 100755 --- a/_assets/scripts/run_functional_tests.sh +++ b/_assets/scripts/run_functional_tests.sh @@ -24,29 +24,36 @@ mkdir -p "${merged_coverage_reports_path}" mkdir -p "${test_results_path}" all_compose_files="-f ${root_path}/docker-compose.anvil.yml -f ${root_path}/docker-compose.test.status-go.yml" +timestamp=$(date +%s) # Run functional tests echo -e "${GRN}Running tests${RST}, HEAD: $(git rev-parse HEAD)" -docker-compose ${all_compose_files} up -d --build --remove-orphans +docker-compose -p ${timestamp} ${all_compose_files} up -d --build --remove-orphans echo -e "${GRN}Running tests-rpc${RST}" # Follow the logs, wait for them to finish -docker-compose ${all_compose_files} logs -f tests-rpc > "${root_path}/tests-rpc.log" +docker-compose -p ${timestamp} ${all_compose_files} logs -f tests-rpc > "${root_path}/tests-rpc.log" # Stop containers echo -e "${GRN}Stopping docker containers${RST}" -docker-compose ${all_compose_files} stop +docker-compose -p ${timestamp} ${all_compose_files} stop # Save logs echo -e "${GRN}Saving logs${RST}" -docker-compose ${all_compose_files} logs status-go > "${root_path}/statusd.log" -docker-compose ${all_compose_files} logs status-go-no-funds > "${root_path}/statusd-no-funds.log" +docker-compose -p ${timestamp} ${all_compose_files} logs status-go > "${root_path}/statusd.log" +docker-compose -p ${timestamp} ${all_compose_files} logs status-backend > "${root_path}/status-backend.log" + +if [ "$(uname)" = "Darwin" ]; then + separator="-" +else + separator="_" +fi # Retrieve exit code -exit_code=$(docker inspect tests-functional_tests-rpc_1 -f '{{.State.ExitCode}}'); +exit_code=$(docker inspect ${timestamp}${separator}tests-rpc${separator}1 -f '{{.State.ExitCode}}'); # Cleanup containers echo -e "${GRN}Removing docker containers${RST}" -docker-compose ${all_compose_files} down +docker-compose -p ${timestamp} ${all_compose_files} down # Collect coverage reports echo -e "${GRN}Collecting code coverage reports${RST}" From 255793d116731e8dcab1b29ac1ddbd6bd8ee439d Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 28 Oct 2024 17:05:24 +0100 Subject: [PATCH 2/2] test_: use docker compose v2, more concrete project name --- _assets/scripts/run_functional_tests.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_assets/scripts/run_functional_tests.sh b/_assets/scripts/run_functional_tests.sh index 4d5d18264d0..ec0012c2df2 100755 --- a/_assets/scripts/run_functional_tests.sh +++ b/_assets/scripts/run_functional_tests.sh @@ -24,23 +24,23 @@ mkdir -p "${merged_coverage_reports_path}" mkdir -p "${test_results_path}" all_compose_files="-f ${root_path}/docker-compose.anvil.yml -f ${root_path}/docker-compose.test.status-go.yml" -timestamp=$(date +%s) +project_name="status-go-func-tests-$(date +%s)" # Run functional tests echo -e "${GRN}Running tests${RST}, HEAD: $(git rev-parse HEAD)" -docker-compose -p ${timestamp} ${all_compose_files} up -d --build --remove-orphans +docker compose -p ${project_name} ${all_compose_files} up -d --build --remove-orphans echo -e "${GRN}Running tests-rpc${RST}" # Follow the logs, wait for them to finish -docker-compose -p ${timestamp} ${all_compose_files} logs -f tests-rpc > "${root_path}/tests-rpc.log" +docker compose -p ${project_name} ${all_compose_files} logs -f tests-rpc > "${root_path}/tests-rpc.log" # Stop containers echo -e "${GRN}Stopping docker containers${RST}" -docker-compose -p ${timestamp} ${all_compose_files} stop +docker compose -p ${project_name} ${all_compose_files} stop # Save logs echo -e "${GRN}Saving logs${RST}" -docker-compose -p ${timestamp} ${all_compose_files} logs status-go > "${root_path}/statusd.log" -docker-compose -p ${timestamp} ${all_compose_files} logs status-backend > "${root_path}/status-backend.log" +docker compose -p ${project_name} ${all_compose_files} logs status-go > "${root_path}/statusd.log" +docker compose -p ${project_name} ${all_compose_files} logs status-backend > "${root_path}/status-backend.log" if [ "$(uname)" = "Darwin" ]; then separator="-" @@ -49,11 +49,11 @@ else fi # Retrieve exit code -exit_code=$(docker inspect ${timestamp}${separator}tests-rpc${separator}1 -f '{{.State.ExitCode}}'); +exit_code=$(docker inspect ${project_name}${separator}tests-rpc${separator}1 -f '{{.State.ExitCode}}'); # Cleanup containers echo -e "${GRN}Removing docker containers${RST}" -docker-compose -p ${timestamp} ${all_compose_files} down +docker compose -p ${project_name} ${all_compose_files} down # Collect coverage reports echo -e "${GRN}Collecting code coverage reports${RST}"