File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed
.test/tests/templates-resolver-ipv6 Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ [ " $DEBUG " ] && set -x
4+
5+ set -eo pipefail
6+
7+ # check if we have ipv6 available
8+ if [ ! -f " /proc/net/if_inet6" ]; then
9+ exit 0
10+ fi
11+
12+ dir=" $( dirname " $( readlink -f " $BASH_SOURCE " ) " ) "
13+
14+ image=" $1 "
15+
16+ clientImage=' buildpack-deps:buster-curl'
17+ # ensure the clientImage is ready and available
18+ if ! docker image inspect " $clientImage " & > /dev/null; then
19+ docker pull " $clientImage " > /dev/null
20+ fi
21+
22+ # Create a new Docker network
23+ nid=" $( docker network create --ipv6 --subnet fd0c:7e57::/64 nginx-test-ipv6-network) "
24+ trap " docker network rm -f $nid > /dev/null" EXIT
25+
26+ # Create an instance of the container-under-test
27+ serverImage=" $( " $HOME /oi/test/tests/image-name.sh" librarytest/nginx-template " $image " ) "
28+ " $HOME /oi/test/tests/docker-build.sh" " $dir " " $serverImage " << EOD
29+ FROM $image
30+ COPY dir/server.conf.template /etc/nginx/templates/server.conf.template
31+ EOD
32+ cid=" $( docker run -d --network $nid -e NGINX_ENTRYPOINT_LOCAL_RESOLVERS=true -e NGINX_MY_SERVER_NAME=example.com " $serverImage " ) "
33+ trap " docker rm -vf $cid > /dev/null" EXIT
34+
35+ _request () {
36+ local method=" $1 "
37+ shift
38+
39+ local proto=" $1 "
40+ shift
41+
42+ local url=" ${1#/ } "
43+ shift
44+
45+ if [ " $( docker inspect -f ' {{.State.Running}}' " $cid " 2> /dev/null) " != ' true' ]; then
46+ echo >&2 " $image stopped unexpectedly!"
47+ ( set -x && docker logs " $cid " ) >&2 || true
48+ false
49+ fi
50+
51+ docker run --rm \
52+ --link " $cid " :nginx \
53+ " $clientImage " \
54+ curl -fsSL -X" $method " --connect-to ' ::nginx:' " $@ " " $proto ://example.com/$url "
55+ }
56+
57+ . " $HOME /oi/test/retry.sh" ' [ "$(_request GET / --output /dev/null || echo $?)" != 7 ]'
58+
59+ # Check that we can request /
60+ _request GET http ' /resolver-templates' | grep ' example.com - OK'
Original file line number Diff line number Diff line change 1+ resolver ${NGINX_LOCAL_RESOLVERS};
2+
3+ server {
4+ listen 80;
5+ server_name ${NGINX_MY_SERVER_NAME};
6+ default_type text/plain;
7+ location = / { return 200 'OK\n'; }
8+ location / { return 200 "${NGINX_MY_SERVER_NAME} - OK\n"; }
9+ }
You can’t perform that action at this time.
0 commit comments