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

[ "$DEBUG" ] && set -x

set -eo pipefail

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

image="$1"

clientImage='buildpack-deps:jessie-curl'

# Create an instance of the container-under-test
serverImage="$("$dir/../image-name.sh" librarytest/haproxy-basics "$image")"
fi

# Create an instance of the container-under-test
serverImage="$("$dir/../image-name.sh" librarytest/haproxy-basics "$image")"
"$dir/../docker-build.sh" "$dir" "$serverImage" <<EOD
FROM $image
COPY dir/haproxy.cfg /usr/local/etc/haproxy/
EOD
cid="$(docker run -d --sysctl net.ipv4.ip_unprivileged_port_start=0 "$serverImage")"
trap "docker rm -vf $cid > /dev/null" EXIT

_request() {
	local method="$1"
	shift

	local proto="$1"
	shift

	fi

	docker run --rm --link "$cid":haproxy "$clientImage" \
		curl -fs -X"$method" --header 'Host: www.google.com' "$@" "http://haproxy/$url"
}

. "$dir/../../retry.sh" '[ "$(_request GET / --output /dev/null || echo $?)" != 7 ]'
	fi

	docker run --rm \
		--link "$cid":haproxy \
		"$clientImage" \
		curl -fsSL -X"$method" --connect-to '::haproxy:' "$@" "$proto://example.com/$url"
}

. "$dir/../../retry.sh" '[ "$(_request GET / --output /dev/null || echo $?)" != 7 ]'

# Check that we can request / (which is proxying example.com)
_request GET http '/' | grep '<h1>Example Domain</h1>' > /dev/null
_request GET https '/' | grep '<h1>Example Domain</h1>' > /dev/null

<MSG> Update haproxy test to use curl's --resolve option

<DFF> @@ -8,7 +8,7 @@ dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
 
 image="$1"
 
-clientImage='buildpack-deps:jessie-curl'
+clientImage='buildpack-deps:stretch-curl'
 
 # Create an instance of the container-under-test
 serverImage="$("$dir/../image-name.sh" librarytest/haproxy-basics "$image")"
@@ -33,7 +33,7 @@ _request() {
 	fi
 
 	docker run --rm --link "$cid":haproxy "$clientImage" \
-		curl -fs -X"$method" --header 'Host: www.google.com' "$@" "http://haproxy/$url"
+		curl -fsSL -X"$method" --resolve www.google.com:80:$(docker inspect -f '{{.NetworkSettings.IPAddress}}' $cid) "$@" "http://www.google.com/$url"
 }
 
 . "$dir/../../retry.sh" '[ "$(_request GET / --output /dev/null || echo $?)" != 7 ]'

Update haproxy test to use curl's --resolve option