| |
@@ -31,6 +31,7 @@
|
| |
|
| |
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,17 @@
|
| |
|
| |
if [ -n "$enable_py3" ]; then
|
| |
test_image="${image_ns}/mbs-test-fedora"
|
| |
+ test_container_name="${test_container_name}-py3"
|
| |
+ db_container_name="${db_container_name}-py3"
|
| |
else
|
| |
test_image="${image_ns}/mbs-test-centos"
|
| |
fi
|
| |
|
| |
- container_opts=(--rm -v "${volume_mount}" --name mbs-test)
|
| |
+ now=$(date +"%H%M%S")
|
| |
+ db_container_name="${db_container_name}-$now"
|
| |
+ test_container_name="${test_container_name}-$now"
|
| |
+
|
| |
+ container_opts=(--rm -v "${volume_mount}" --name "$test_container_name")
|
| |
|
| |
if [ -z "$no_tty" ]; then
|
| |
container_opts+=(-i -t)
|
| |
@@ -58,7 +65,7 @@
|
| |
# Setting this password makes it possible to get into database container
|
| |
# and check the data.
|
| |
db_bg_container=$(
|
| |
- docker run --rm --name $db_container_name \
|
| |
+ docker run --rm --name "$db_container_name" \
|
| |
-e POSTGRES_PASSWORD=$db_password \
|
| |
-e POSTGRES_DB=$db_name \
|
| |
-d \
|
| |
@@ -68,8 +75,7 @@
|
| |
# 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
|
| |