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

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

This commit is contained in:
Thomas LEVEIL 2017-02-11 02:23:07 +01:00
parent 3e92192dc4
commit fdde850fc2
2 changed files with 11 additions and 4 deletions

View File

@ -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/). 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. 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: 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:

View File

@ -290,8 +290,6 @@ def docker_compose(request):
""" """
docker_compose_file = find_docker_compose_file(request) docker_compose_file = find_docker_compose_file(request)
original_dns_resolver = monkey_patch_urllib_dns_resolver() 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() remove_all_containers()
docker_compose_up(docker_compose_file) docker_compose_up(docker_compose_file)
networks = connect_to_all_networks() 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 logs', docker_client.logs(container['Id']))
report.longrepr.addsection('nginx-proxy conf', get_nginx_conf_from_container(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")