diff --git a/_assets/ci/Jenkinsfile.tests-rpc b/_assets/ci/Jenkinsfile.tests-rpc index afada1bad..3bfdc4c0c 100644 --- a/_assets/ci/Jenkinsfile.tests-rpc +++ b/_assets/ci/Jenkinsfile.tests-rpc @@ -76,7 +76,14 @@ pipeline { } success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make git-clean' } + cleanup { + script { + sh ''' + docker ps -a --filter "name=status-go-func-tests-${BUILD_ID}" -q | xargs -r docker rm + make git-clean + ''' + } + } } // post } // pipeline diff --git a/_assets/scripts/run_functional_tests.sh b/_assets/scripts/run_functional_tests.sh index b37c9024f..ebb63ef84 100755 --- a/_assets/scripts/run_functional_tests.sh +++ b/_assets/scripts/run_functional_tests.sh @@ -24,13 +24,13 @@ 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=$(python3 -c "import time; print(int(time.time() * 1000))") # Keep in sync with status_backend.py -project_name="status-go-func-tests-${timestamp}" +identifier=${BUILD_ID:-$(git rev-parse --short HEAD)} +project_name="status-go-func-tests-${identifier}" export STATUS_BACKEND_URLS=$(eval echo http://${project_name}-status-backend-{1..${STATUS_BACKEND_COUNT}}:3333 | tr ' ' ,) # Remove orphans -docker ps -a --filter "name=status-go-func-tests-*-status-backend-*" --filter "status=exited" -q | xargs -r docker rm +docker ps -a --filter "status-go-func-tests-${identifier}" --filter "status=exited" -q | xargs -r docker rm # Run docker echo -e "${GRN}Running tests${RST}, HEAD: $(git rev-parse HEAD)" @@ -83,4 +83,4 @@ if [[ ${FUNCTIONAL_TESTS_REPORT_CODECOV} == 'true' ]]; then fi echo -e "${GRN}Testing finished${RST}" -exit $exit_code \ No newline at end of file +exit $exit_code diff --git a/tests-functional/clients/status_backend.py b/tests-functional/clients/status_backend.py index e3ace0244..cd026c631 100644 --- a/tests-functional/clients/status_backend.py +++ b/tests-functional/clients/status_backend.py @@ -63,9 +63,9 @@ class StatusBackend(RpcClient, SignalClient): def _start_container(self, host_port, privileged): docker_project_name = option.docker_project_name - timestamp = int(time.time() * 1000) # Keep in sync with run_functional_tests.sh + identifier = os.environ.get("BUILD_ID") if os.environ.get("CI") else os.popen("git rev-parse --short HEAD").read().strip() image_name = f"{docker_project_name}-status-backend:latest" - container_name = f"{docker_project_name}-status-backend-{timestamp}" + container_name = f"{docker_project_name}-{identifier}-status-backend-{host_port}" coverage_path = option.codecov_dir if option.codecov_dir else os.path.abspath("./coverage/binary")