Pārlūkot izejas kodu

TESTS: pytest checks the existance of the jwilder/nginx-proxy:test image

Thomas LEVEIL 8 gadi atpakaļ
vecāks
revīzija
fdde850fc2
2 mainītis faili ar 11 papildinājumiem un 4 dzēšanām
  1. 0 2
      test2/README.md
  2. 11 2
      test2/conftest.py

+ 0 - 2
test2/README.md

@@ -60,8 +60,6 @@ So all the following domain names will resolve to the nginx-proxy container in t
 
 When using the `docker_compose` fixture in a test, pytest will try to find a yml file named after your test module filename. For instance, if your test module is `test_example.py`, then the `docker_compose` fixture will try to load a `test_example.yml` [docker compose file](https://docs.docker.com/compose/compose-file/).
 
-The only requirement within that compose file is to have a container declared from the docker image `jwilder/nginx-proxy:test`.
-
 Once the docker compose file found, the fixture will remove all containers, run `docker-compose up`, and finally your test will be executed.
 
 The fixture will run the _docker-compose_ command with the `-f` option to load the given compose file. So you can test your docker compose file syntax by running it yourself with:

+ 11 - 2
test2/conftest.py

@@ -290,8 +290,6 @@ def docker_compose(request):
     """
     docker_compose_file = find_docker_compose_file(request)
     original_dns_resolver = monkey_patch_urllib_dns_resolver()
-    if not check_sut_image():
-        pytest.exit("The docker image 'jwilder/nginx-proxy:test' is missing")
     remove_all_containers()
     docker_compose_up(docker_compose_file)
     networks = connect_to_all_networks()
@@ -330,3 +328,14 @@ def pytest_runtest_logreport(report):
             report.longrepr.addsection('nginx-proxy logs', docker_client.logs(container['Id']))
             report.longrepr.addsection('nginx-proxy conf', get_nginx_conf_from_container(container['Id']))
 
+
+
+###############################################################################
+# 
+# Check requirements
+# 
+###############################################################################
+
+
+if not check_sut_image():
+    pytest.exit("The docker image 'jwilder/nginx-proxy:test' is missing")