Explorar el Código

Unit test - removed network creation

Baptiste Donaux hace 9 años
padre
commit
b42cd85570
Se han modificado 2 ficheros con 2 adiciones y 20 borrados
  1. 2 9
      test/docker.bats
  2. 0 11
      test/lib/docker_helpers.bash

+ 2 - 9
test/docker.bats

@@ -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'
 }
-

+ 0 - 11
test/lib/docker_helpers.bash

@@ -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