<NME> run.sh
<BEF> #!/bin/bash

[ "$DEBUG" ] && set -x

set -eo pipefail

dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"

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")"
"$dir/../docker-build.sh" "$dir" "$serverImage" <<EOD
FROM $image

	local url="${2#/}"

	docker run --rm -i --link "$cid":jetty \
		"$clientImage" -fsSL -X"$method" "http://jetty:8080/$url"
}

# Check that we can request /index.jsp with no params

	local url="${1#/}"
	shift

	docker run --rm \
		--link "$cid":jetty \
		"$clientImage" \
		curl -fs -X"$method" "$@" "http://jetty:8080/$url"
}

# Make sure that Jetty is listening on port 8080
. "$dir/../../retry.sh" --tries 40 --sleep 0.25 '[ "$(_request GET / --output /dev/null || echo $?)" != 7 ]'

# Check that we can request /index.jsp with no params
[ "$(_request GET "/" | tail -1)" = "null" ]

# Check that our index.jsp echoes the value of the "hello" param
hello="world-$RANDOM-$RANDOM"
[ "$(_request GET "/?hello=$hello" | tail -1)" = "$hello" ]

<MSG> Merge pull request #1004 from appropriate/jetty-hello-web-fix

Specify "curl" command explicitly in jetty-hello-web
<DFF> @@ -22,8 +22,8 @@ _request() {
 
 	local url="${2#/}"
 
-	docker run --rm -i --link "$cid":jetty \
-		"$clientImage" -fsSL -X"$method" "http://jetty:8080/$url"
+	docker run --rm -i --link "$cid":jetty "$clientImage" \
+		curl -fsSL -X"$method" "http://jetty:8080/$url"
 }
 
 # Check that we can request /index.jsp with no params

Merge pull request #1004 from appropriate/jetty-hello-web-fix