Skip to content
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

Add container logs in case testcontainer exited unexpectedly #1895

Merged
merged 1 commit into from
Feb 22, 2022

Conversation

R0Wi
Copy link
Contributor

@R0Wi R0Wi commented Feb 20, 2022

When running tests against the nginxproxy/nginx-proxy:test it can happen that someone uses an invalid configuration yaml file for spinning up containers. It then can happen that the proxy container exits immediately and the test logs don't provide any further information.

This PR adds the docker container logs output in case the nginxproxy/nginx-proxy:test exited unexpectedly before tests are run.

A sample output looks like this:

DEBUG    DNS:conftest.py:243 resolving domain name ('www.web2.nginx-proxy.tld', 80, <AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>)
DEBUG    DNS:conftest.py:190 nginx_proxy_dns_resolver('www.web2.nginx-proxy.tld')
WARNING  DNS:conftest.py:194 no container found from image nginxproxy/nginx-proxy:test while resolving 'www.web2.nginx-proxy.tld'
WARNING  DNS:conftest.py:198 nginxproxy/nginx-proxy:test container might have exited unexpectedly. Container logs: 
Info: running nginx-proxy version test
Setting up DH Parameters..
cp: cannot create regular file '/etc/nginx/dhparam/dhparam.pem/ffdhe4096.pem': Read-only file system

DEBUG    DNS:conftest.py:213 docker_container_dns_resolver('www.web2.nginx-proxy.tld')
DEBUG    DNS:conftest.py:217 'www.web2.nginx-proxy.tld' does not match

The additional warning helps to figure out what went wrong especially when running test on CI platforms like Github Actions.

@buchdag buchdag added the type/test PR that add missing tests or correct existing tests label Feb 21, 2022
@buchdag buchdag merged commit 9cdb804 into nginx-proxy:main Feb 22, 2022
@buchdag
Copy link
Member

buchdag commented Feb 22, 2022

Thanks !

@R0Wi R0Wi deleted the feature/add-container-logs branch February 22, 2022 07:46
RomainMou added a commit to bimdata/nginx-proxy that referenced this pull request Mar 7, 2022
Merge pull request nginx-proxy#1895 from seitenwerke/feature/add-container-logs

Add container logs in case testcontainer exited unexpectedly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/test PR that add missing tests or correct existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants