From 5baaeb2fc779fd27d709aa87861cc131919711d5 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Tue, 16 Jul 2019 09:44:32 +0800 Subject: [PATCH] Give a unique name to container running tests inside Signed-off-by: Chenxiong Qi --- contrib/run-unittests.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/run-unittests.sh b/contrib/run-unittests.sh index 641ae7e8..f4d9d549 100755 --- a/contrib/run-unittests.sh +++ b/contrib/run-unittests.sh @@ -31,6 +31,7 @@ done image_ns=quay.io/factory2 postgres_image="postgres:9.5.17" +test_container_name="mbs-test" db_container_name="mbs-test-db" source_dir="$(realpath "$(dirname "$0")/..")" volume_mount="${source_dir}:/src:Z" @@ -41,11 +42,13 @@ db_bg_container= if [ -n "$enable_py3" ]; then test_image="${image_ns}/mbs-test-fedora" + test_container_name="${test_container_name}-py3" else test_image="${image_ns}/mbs-test-centos" fi -container_opts=(--rm -v "${volume_mount}" --name mbs-test) +test_container_name="${test_container_name}-$(date +"%H%M%S")" +container_opts=(--rm -v "${volume_mount}" --name "$test_container_name") if [ -z "$no_tty" ]; then container_opts+=(-i -t) @@ -68,8 +71,7 @@ if [ -n "$with_pgsql" ]; then # Waiting for postgres container to start completely in case tests start too fast. while true do - docker exec $db_bg_container psql -U postgres -c '\dp' $db_name >/dev/null 2>&1 - if [ $? == 0 ]; then + if docker exec "$db_bg_container" psql -U postgres -c '\dp' $db_name >/dev/null 2>&1; then break fi done