-
Notifications
You must be signed in to change notification settings - Fork 3.1k
tests: factor out base nginx-proxy config and enable local testing on macOS / Darwin #2570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
daa9449
tests: factor out base nginx-proxy config
buchdag 40309e2
tests: enable local testing on macOS / Darwin
buchdag bfdd72f
tests: type hints and linting
buchdag 005377c
tests: remove remaining unneeded container config
buchdag 836012c
docs: update test README
buchdag aa8145b
tests: review changes
buchdag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
services: | ||
nginx-proxy: | ||
image: nginxproxy/nginx-proxy:test | ||
container_name: nginx-proxy | ||
volumes: | ||
- /var/run/docker.sock:/tmp/docker.sock:ro | ||
ports: | ||
- "80:80" | ||
- "443:443" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really related to this PR but why we sleep 3 seconds here?
wait_for_nginxproxy_to_be_ready()
checks already to have nginx-proxy ready (real-time stream)So that sleeps just seems to be for the 'web' container. But I don't think that needs 3 seconds.
And as we do like 90 compose up's thats already 270 seconds of waiting (4,5 min).
A good win to reduce test time I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's something I tried to work on, one problem is that in its current state
wait_for_nginxproxy_to_be_ready()
does not seem to really tell us if the proxy is actually ready or not.docker_client.containers.list()
found zero or more than one container, the function will return without any further check.for line in container.logs(stream=True):
mean that the function will wait for the expected log line to appear, for me it will just iterate over the the log lines generated by the container up to that point, return early if it findWatching docker events
or return anyway when it reach the end of the generator.Watching docker events
log line mean that docker-gen is ready, not that nginx has loaded the docker-gen generated conf, which is what we're actually testing.We're automatically doing a 9s backoff on 404 or 503 when using the
nginxproxy
fixture'sget()
which kind of automatically wait for the containers to be ready, but not all tests are using this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you are right, that ready state is indeed based of docker-gen.
Changing the bytestring to something else makes the for loop block. So it will wait. But the
Watching docker events
is probably always there.Adding
follow=True
infor line in container.logs(stream=True, follow=True):
makes the generator follow new events in the stream.