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 test to check if Nginx is serving requests #308

Merged
merged 1 commit into from May 5, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -23,6 +23,6 @@ else

# TODO: don't hard-code this
if [ "${SALT_NODE_ID}" = "servo-master1" ]; then
./test.py sls.buildbot.master
./test.py sls.buildbot.master sls.nginx
fi
fi
No changes.
@@ -0,0 +1,23 @@
import urllib.request
import urllib.error

from tests.util import Failure, Success


def run():
try:
urllib.request.urlopen('http://localhost/')
except urllib.error.URLError as e:
# Can call e.read() if there was a response but the HTTP status code
# indicated error; the method is unavailable if a connection could not
# be made. Nginx is reverse proxying Homu and Buildbot, which will be
# dead on Travis because the test pillar credentials are not valid.

# Also, we're 'expecting' a string for e.reason (for the connection
# refused error case), but it may be another exception instance.
if not hasattr(e, 'read'):
return Failure("Nginx is not serving requests:", str(e.reason))

# No need to catch HTTPError or ContentTooShortError specially here

return Success("Nginx is serving requests")
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.