Browse Source

Merge pull request #8040 from infosiftr/gollum

Have tests pull external images
Tianon Gravi 5 years ago
parent
commit
3980f8d687

+ 1 - 1
test-pr.sh

@@ -101,7 +101,7 @@ if [ -z "$BASHBREW_SECOND_STAGE" ]; then
 
 	cmd=( ./test-pr.sh "$pull" "$@" )
 
-	if [ -t 1 ]; then
+	if [ -t 0 ] && [ -t 1 ]; then
 		# only add "-t" if we have a TTY
 		args+=( -t )
 	fi

+ 4 - 0
test/run.sh

@@ -110,6 +110,10 @@ for dockerImage in "$@"; do
 			# ONCE ONBUILD, ALWAYS ONBUILD
 			variant='onbuild'
 			;;
+		*apache-*)
+			# lolPHP
+			variant='apache'
+			;;
 		*fpm-*)
 			# lolPHP
 			variant='fpm'

+ 4 - 0
test/tests/convertigo-hello-world/run.sh

@@ -7,6 +7,10 @@ serverImage="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 cid="$(docker run -d "$serverImage")"

+ 6 - 0
test/tests/docker-registry-push-pull/run.sh

@@ -8,10 +8,16 @@ case "${image##*/}" in
 	docker:*dind*)
 		dockerImage="$image"
 		registryImage='registry'
+		if ! docker image inspect "$registryImage" &> /dev/null; then
+			docker pull "$registryImage" > /dev/null
+		fi
 		;;
 	registry:*|registry)
 		registryImage="$image"
 		dockerImage='docker:dind'
+		if ! docker image inspect "$dockerImage" &> /dev/null; then
+			docker pull "$dockerImage" > /dev/null
+		fi
 		;;
 	*)
 		echo >&2 "error: unable to determine whether '$image' is registry or docker:dind"

+ 4 - 0
test/tests/elasticsearch-basics/run.sh

@@ -10,6 +10,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 # (explicitly setting a low memory limit since the image defaults to 2GB)

+ 4 - 0
test/tests/ghost-basics/run.sh

@@ -7,6 +7,10 @@ serverImage="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 cid="$(docker run -d "$serverImage")"

+ 4 - 0
test/tests/haproxy-basics/run.sh

@@ -9,6 +9,10 @@ dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
 image="$1"
 
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 serverImage="$("$dir/../image-name.sh" librarytest/haproxy-basics "$image")"

+ 4 - 0
test/tests/jetty-hello-web/run.sh

@@ -10,6 +10,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 serverImage="$("$dir/../image-name.sh" librarytest/jetty-hello-web "$image")"

+ 4 - 0
test/tests/logstash-basics/run.sh

@@ -10,6 +10,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # input via HTTP (default port 0.0.0.0:8080)
 # output via stdout, newline-delimited nothing-but-the-message

+ 4 - 0
test/tests/memcached-basics/run.sh

@@ -7,6 +7,10 @@ image="$1"
 
 # for "nc"
 clientImage='busybox'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 cname="memcached-container-$RANDOM-$RANDOM"
 cid="$(docker run -d --name "$cname" "$image")"

+ 10 - 1
test/tests/mongo-express-run/run.sh

@@ -3,10 +3,19 @@ set -Eeuo pipefail
 
 dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
 
+serverImage="$1"
+
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 mongoImage='mongo:4.0'
-serverImage="$1"
+# ensure the mongoImage is ready and available
+if ! docker image inspect "$mongoImage" &> /dev/null; then
+	docker pull "$mongoImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 mongoCid="$(docker run -d "$mongoImage")"

+ 4 - 0
test/tests/nextcloud-apache-run/run.sh

@@ -7,6 +7,10 @@ serverImage="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 cid="$(docker run -d "$serverImage")"

+ 4 - 0
test/tests/nextcloud-cli-mysql/run.sh

@@ -4,6 +4,10 @@ set -eo pipefail
 dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
 
 dbImage='mariadb:10.3'
+# ensure the dbImage is ready and available
+if ! docker image inspect "$dbImage" &> /dev/null; then
+	docker pull "$dbImage" > /dev/null
+fi
 serverImage="$1"
 dbPass="test-$RANDOM-password-$RANDOM-$$"
 dbName="test-$RANDOM-db"

+ 4 - 0
test/tests/nextcloud-cli-postgres/run.sh

@@ -4,6 +4,10 @@ set -eo pipefail
 dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
 
 dbImage='postgres:11-alpine'
+# ensure the dbImage is ready and available
+if ! docker image inspect "$dbImage" &> /dev/null; then
+	docker pull "$dbImage" > /dev/null
+fi
 serverImage="$1"
 dbPass="test-$RANDOM-password-$RANDOM-$$"
 dbName="test_${RANDOM}_db" # dbName has to be set to something that does not require escaping: https://github.com/docker-library/official-images/pull/6252#issuecomment-520095703

+ 4 - 0
test/tests/open-liberty-hello-world/run.sh

@@ -7,6 +7,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 serverImage="$1"
 

+ 4 - 0
test/tests/php-apache-hello-web/run.sh

@@ -7,6 +7,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 serverImage="$("$dir/../image-name.sh" librarytest/php-apache-hello-web "$image")"
 "$dir/../docker-build.sh" "$dir" "$serverImage" <<EOD

+ 4 - 0
test/tests/rapidoid-hello-world/run.sh

@@ -10,6 +10,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 serverImage="$("$dir/../image-name.sh" librarytest/rapidoid-hello-web "$image")"

+ 4 - 0
test/tests/rapidoid-load-balancer/run.sh

@@ -10,6 +10,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 app1id="$(docker run -d "$image" rapidoid.port=80 id=app1 app.services=ping,status)"
 app2id="$(docker run -d "$image" rapidoid.port=80 id=app2 app.services=ping,status)"

+ 4 - 0
test/tests/redmine-basics/run.sh

@@ -7,6 +7,10 @@ serverImage="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 cid="$(docker run -d "$serverImage")"

+ 4 - 0
test/tests/silverpeas-basics/run.sh

@@ -7,6 +7,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 cname="silverpeas-container-$RANDOM-$RANDOM"
 # when running the first time, a silverpeas process is spawn before starting Silverpeas

+ 4 - 0
test/tests/tomcat-hello-world/run.sh

@@ -7,6 +7,10 @@ image="$1"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 serverImage="$("$dir/../image-name.sh" librarytest/tomcat-hello-world "$image")"
 "$dir/../docker-build.sh" "$dir" "$serverImage" <<EOD

+ 8 - 0
test/tests/wordpress-apache-run/run.sh

@@ -5,8 +5,16 @@ dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
 
 # Use a client image with curl for testing
 clientImage='buildpack-deps:buster-curl'
+# ensure the clientImage is ready and available
+if ! docker image inspect "$clientImage" &> /dev/null; then
+	docker pull "$clientImage" > /dev/null
+fi
 
 mysqlImage='mysql:5.7'
+# ensure the mysqlImage is ready and available
+if ! docker image inspect "$mysqlImage" &> /dev/null; then
+	docker pull "$mysqlImage" > /dev/null
+fi
 serverImage="$1"
 
 # Create an instance of the container-under-test

+ 4 - 0
test/tests/wordpress-fpm-run/run.sh

@@ -16,6 +16,10 @@ ENTRYPOINT ["cgi-fcgi"]
 EOF
 
 mysqlImage='mysql:5.7'
+# ensure the mysqlImage is ready and available
+if ! docker image inspect "$mysqlImage" &> /dev/null; then
+	docker pull "$mysqlImage" > /dev/null
+fi
 
 # Create an instance of the container-under-test
 mysqlCid="$(docker run -d -e MYSQL_ROOT_PASSWORD="test-$RANDOM-password-$RANDOM-$$" "$mysqlImage")"