Skip to content

Commit

Permalink
Have tests pull external images
Browse files Browse the repository at this point in the history
also fix test-pr tty handling
  • Loading branch information
yosifkit committed May 20, 2020
1 parent b4ac641 commit 6fdfcac
Show file tree
Hide file tree
Showing 22 changed files with 97 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tests/convertigo-hello-world/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
6 changes: 6 additions & 0 deletions test/tests/docker-registry-push-pull/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/elasticsearch-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions test/tests/ghost-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/haproxy-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/jetty-hello-web/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/logstash-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tests/memcached-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
11 changes: 10 additions & 1 deletion test/tests/mongo-express-run/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/nextcloud-apache-run/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/nextcloud-cli-mysql/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/nextcloud-cli-postgres/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tests/open-liberty-hello-world/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 4 additions & 0 deletions test/tests/php-apache-hello-web/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tests/rapidoid-hello-world/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/rapidoid-load-balancer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/redmine-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
4 changes: 4 additions & 0 deletions test/tests/silverpeas-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tests/tomcat-hello-world/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/tests/wordpress-apache-run/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tests/wordpress-fpm-run/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down

0 comments on commit 6fdfcac

Please sign in to comment.