1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 01:38:15 +00:00

docs: update "how to install/test" parts

This commit is contained in:
Kevin Marilleau 2021-04-26 23:15:08 +02:00 committed by Nicolas Duchon
parent 39f822dd8b
commit 1518c39e1b
No known key found for this signature in database
GPG Key ID: EA3151C66A4D79E7
3 changed files with 13 additions and 25 deletions

View File

@ -415,22 +415,15 @@ Before submitting pull requests or issues, please check github to make sure an e
#### Running Tests Locally
To run tests, you need to prepare the docker image to test which must be tagged `nginxproxy/nginx-proxy:test`:
docker build -t nginxproxy/nginx-proxy:test . # build the Debian variant image
and call the [test/pytest.sh](test/pytest.sh) script.
Then build the Alpine variant of the image:
docker build -f Dockerfile.alpine -t nginxproxy/nginx-proxy:test . # build the Alpline variant image
and call the [test/pytest.sh](test/pytest.sh) script again.
If your system has the `make` command, you can automate those tasks by calling:
To run tests, you just need to run the command below:
make test
This commands run tests on two variants of the nginx-proxy docker image: Debian and Alpine.
You can run the tests for each of these images with their respective commands:
make test-debian
make test-alpine
You can learn more about how the test suite works and how to write new tests in the [test/README.md](test/README.md) file.

View File

@ -4,9 +4,8 @@ Nginx proxy test suite
Install requirements
--------------------
You need [python 2.7](https://www.python.org/) and [pip](https://pip.pypa.io/en/stable/installing/) installed. Then run the commands:
You need [python 3.9](https://www.python.org/) and [pip](https://pip.pypa.io/en/stable/installing/) installed. Then run the commands:
requirements/build.sh
pip install -r requirements/python-requirements.txt
If you can't install those requirements on your computer, you can alternatively use the _pytest.sh_ script which will run the tests from a Docker container which has those requirements.
@ -15,14 +14,11 @@ If you can't install those requirements on your computer, you can alternatively
Prepare the nginx-proxy test image
----------------------------------
docker build -t nginxproxy/nginx-proxy:test ..
make build-nginx-proxy-test-debian
or if you want to test the alpine flavor:
docker build -t nginxproxy/nginx-proxy:test -f Dockerfile.alpine ..
make sure to tag that test image exactly `nginxproxy/nginx-proxy:test` or the test suite won't work.
make build-nginx-proxy-test-alpine
Run the test suite
------------------
@ -61,7 +57,7 @@ The fixture will run the _docker-compose_ command with the `-f` option to load t
In the case you are running pytest from within a docker container, the `docker_compose` fixture will make sure the container running pytest is attached to all docker networks. That way, your test will be able to reach any of them.
In your tests, you can use the `docker_compose` variable to query and command the docker daemon as it provides you with a [client from the docker python module](https://docker-py.readthedocs.io/en/2.0.2/client.html#client-reference).
In your tests, you can use the `docker_compose` variable to query and command the docker daemon as it provides you with a [client from the docker python module](https://docker-py.readthedocs.io/en/4.4.4/client.html#client-reference).
Also this fixture alters the way the python interpreter resolves domain names to IP addresses in the following ways:
@ -99,8 +95,7 @@ Furthermore, the nginxproxy methods accept an additional keyword parameter: `ipv
### The web docker image
When you ran the `requirements/build.sh` script earlier, you built a [`web`](requirements/README.md) docker image which is convenient for running a small web server in a container. This image can produce containers that listens on multiple ports at the same time.
When you run the `make build-webserver` command, you built a [`web`](requirements/README.md) docker image which is convenient for running a small web server in a container. This image can produce containers that listens on multiple ports at the same time.
### Testing TLS

View File

@ -2,7 +2,7 @@ This directory contains resources to build Docker images tests depend on
# Build images
./build.sh
make build-webserver
# python-requirements.txt