1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-12-25 03:56:31 +00:00

Unit test - removed network creation

This commit is contained in:
Baptiste Donaux 2016-02-26 09:12:11 +01:00
parent 47631eb5de
commit b42cd85570
2 changed files with 2 additions and 20 deletions

View File

@ -54,21 +54,15 @@ load test_helpers
@test "[$TEST_FILE] separated containers (nginx + docker-gen + nginx.tmpl)" {
docker_clean bats-nginx
docker_clean bats-docker-gen
docker_network_clean bats-docker-gen-network
# MAKE network
run docker network create bats-docker-gen-network
assert_success
# GIVEN a simple nginx container
run docker run -d \
--name bats-nginx \
--net=bats-docker-gen-network \
-v /etc/nginx/conf.d/ \
-v /etc/nginx/certs/ \
nginx:latest
assert_success
run retry 5 1s docker run --net=bats-docker-gen-network appropriate/curl --silent --fail --head http://$(docker_ips bats-nginx)/
run retry 5 1s docker run appropriate/curl --silent --fail --head http://$(docker_ip bats-nginx)/
assert_output -l 0 $'HTTP/1.1 200 OK\r'
# WHEN docker-gen runs on our docker host
@ -95,7 +89,7 @@ load test_helpers
docker logs bats-docker-gen
false
} >&2
# THEN
assert_nginxproxy_behaves bats-nginx
}
@ -120,4 +114,3 @@ function assert_nginxproxy_behaves {
run curl_container $container /data --header "Host: webFOO.bats" --head
assert_output -l 0 $'HTTP/1.1 503 Service Temporarily Unavailable\r'
}

View File

@ -8,22 +8,11 @@ function docker_clean {
sleep .25s
}
# Removes network $1
function docker_network_clean {
docker network rm $1 &>/dev/null ||:
sleep .25s
}
# get the ip of docker container $1
function docker_ip {
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1
}
# get the ip of docker container $1
function docker_ips {
docker inspect --format '{{ range .NetworkSettings.Networks }}{{ .IPAddress }}{{ end }}' $1
}
# get the running state of container $1
# → true/false
# fails if the container does not exist