Skip to content

use docker exec to compare backends, rather than querying nginx #46

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 1 commit into from
Apr 5, 2017

Conversation

tgross
Copy link
Contributor

@tgross tgross commented Apr 5, 2017

For #45

Rather than waiting for CNS to catch up, we can instead check the Nginx config files directly against what's expected. This means we don't quite test the Nginx SIGHUP but honestly that should be pretty solid short of a syntax error in the config. Test output:

----------------------------------------------------------------------
NginxStackTest.test_scaleup_and_down
----------------------------------------------------------------------
elapsed  | task
12.75874 | docker-compose -f triton/docker-compose.yml -p nginx stop
16.73752 | docker-compose -f triton/docker-compose.yml -p nginx rm -f
35.06248 | docker-compose -f triton/docker-compose.yml -p nginx up -d
1.950042 | docker-compose -f triton/docker-compose.yml -p nginx ps
1.952207 | docker-compose -f triton/docker-compose.yml -p nginx ps
1.952496 | wait_for_containers: {'consul': 1, 'backend': 1, 'nginx': 1}
0.707822 | docker inspect nginx_consul_1
0.762927 | wait_for_service: backend
1.033709 | wait_for_service: containerpilot
6.161812 | wait_for_service: nginx
0.020028 | wait_for_service: nginx-public
0.096123 | wait_for_cns:
33.31035 | docker-compose -f triton/docker-compose.yml -p nginx scale backend=2
2.719624 | docker-compose -f triton/docker-compose.yml -p nginx ps
2.720015 | wait_for_containers: {'consul': 1, 'backend': 2, 'nginx': 1}
2.066465 | wait_for_service: backend
1.809874 | docker exec nginx_backend_1 ip -o addr
2.784050 | docker exec nginx_backend_2 ip -o addr
2.905334 | docker exec nginx_nginx_1 cat /etc/nginx/conf.d/site.conf
2.706559 | docker exec nginx_backend_2 ifconfig eth0 down
9.237921 | wait_for_service: backend
3.227224 | docker exec nginx_nginx_1 cat /etc/nginx/conf.d/site.conf
2.630694 | docker exec nginx_backend_2 ifconfig eth0 up
7.188679 | wait_for_service: backend
2.902231 | docker exec nginx_nginx_1 cat /etc/nginx/conf.d/site.conf
.
----------------------------------------------------------------------
Ran 1 test in 150.036s

OK

@jasonpincin
Copy link
Contributor

👍

@tgross tgross merged commit f22479c into master Apr 5, 2017
expected.sort()
patt = 'server \d{2,3}\.\d{2,3}\.\d{2,3}\.\d{2,3}\:3001;'
while timeout > 0:
conf = self.docker_exec('nginx_1',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a reliable way to get the site.conf... will 'nginx_1' always exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should, but if nginx_1 doesn't exist at this point, the test should fail anyways.

@misterbisson misterbisson deleted the gh45 branch May 18, 2017 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants