From 4b8a2be57551cf92d2bb02e253f35c2f746cf013 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 23 Nov 2026 13:27:46 +0100 Subject: [PATCH] Tests: remove containers with docker rm -f instead of docker stop With --rm, docker stop returns before the container is removed: the next docker run with the same name can fail with "The container name is already in use". --- tests/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 7b1338bd..11869922 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -18,41 +18,41 @@ test-%: vendor test_3_manual_enabling_extensions.php # Test function handler - docker stop test-php-$* 2> /dev/null || true # silence errors + docker rm -f test-php-$* 2> /dev/null || true # silence errors docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$* \ -e BREF_RUNTIME=function \ bref/php-$* test_4_function_handler.php docker exec test-php-$* php test_4_function_invocation.php \ || (docker logs test-php-$* && exit 1) - docker stop test-php-$* + docker rm -f test-php-$* # Test FPM handler - docker stop test-php-$* 2> /dev/null || true # silence errors + docker rm -f test-php-$* 2> /dev/null || true # silence errors docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$* \ -e BREF_RUNTIME=fpm \ bref/php-$* test_5_fpm_handler.php docker exec test-php-$* php test_5_fpm_invocation.php \ || (docker logs test-php-$* && exit 1) # print logs in case of failure - docker stop test-php-$* + docker rm -f test-php-$* # Test console handler - docker stop test-php-$* 2> /dev/null || true # silence errors + docker rm -f test-php-$* 2> /dev/null || true # silence errors docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$* \ -e BREF_RUNTIME=console \ bref/php-$* test_6_console_handler.php docker exec test-php-$* php test_6_console_invocation.php \ || (docker logs test-php-$* && exit 1) # print logs in case of failure - docker stop test-php-$* + docker rm -f test-php-$* # Test that we can override PHP_INI_SCAN_DIR - docker stop test-php-$*-test7 2> /dev/null || true # silence errors + docker rm -f test-php-$*-test7 2> /dev/null || true # silence errors docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$*-test7 \ -e BREF_RUNTIME=function \ -e PHP_INI_SCAN_DIR="/etc/php/conf.d/:/var/task/" \ bref/php-$* test_4_function_handler.php docker exec test-php-$*-test7 php test_7_custom_ini_scan_dir.php \ || (docker logs test-php-$*-test7 && exit 1) # print logs in case of failure - docker stop test-php-$*-test7 + docker rm -f test-php-$*-test7 echo "\033[1;32m✓ Tests succeeded\033[0m"