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

Feature/bare status #114

Merged
merged 5 commits into from
Jan 31, 2018
Merged

Feature/bare status #114

merged 5 commits into from
Jan 31, 2018

Conversation

jmaroeder
Copy link
Contributor

Addresses #113

@coveralls
Copy link

coveralls commented Jan 24, 2018

Coverage Status

Coverage increased (+0.1%) to 87.589% when pulling ae48537 on jamesmallen:feature/bare-status into 4defc4a on mwarkentin:master.

@mwarkentin
Copy link
Owner

Thanks for the submission, I’ll try to take a look soon. 😊

@jmaroeder
Copy link
Contributor Author

@mwarkentin Did you get a chance to look at this yet?

@mwarkentin
Copy link
Owner

Hey @jamesmallen - initial review looks good, just trying to review the diff in views.py.

Copy link
Owner

@mwarkentin mwarkentin left a comment

Choose a reason for hiding this comment

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

@jamesmallen Sorry about the delay - had a chance to run through it and I think everything looks good. Just a few small tweaks and I'll be happy to merge!

def dashboard(request):
_deprecation_warnings()
def bare_status(request):
checks, ok = run_checks(request)
Copy link
Owner

Choose a reason for hiding this comment

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

Do you want to handle the "no checks" case here or are you ok with a 200 even if nothing has been checked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For our needs, a 200 even if nothing has been checked is fine - that is a legitimate situation where the webserver is up and responding from our POV (and there might not be any other subsystems to check)

Copy link
Owner

Choose a reason for hiding this comment

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

👍

Copy link
Owner

Choose a reason for hiding this comment

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

Not sure if you saw the ping endpoint which was added in the previous release, it’s use case is very similar.

@@ -172,6 +172,17 @@ requests, you can call ping:
It will return the text ``pong`` with a 200 status code. Calling this doesn't
run any of the checks.

Bare status view
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a 0.15.0 (Unreleased) heading to the history file and add a bullet for this feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 657f135

self.assertEqual(response.content.decode(), '')

@patch('watchman.checks._check_databases')
@override_settings(WATCHMAN_ERROR_CODE=503)
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add another test that the default error code for the bare status view will be 500? You can just copy this one without the override.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 657f135


return HttpResponse('pong', content_type='text/plain')
return checks, 200 if ok else settings.WATCHMAN_ERROR_CODE, {WATCHMAN_VERSION_HEADER: __version__}
Copy link
Owner

Choose a reason for hiding this comment

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

Would you mind pulling the http_code out into it's own variable directly above? Just makes this line a bit easier to parse I think (same for in bare_status).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 657f135

Copy link
Owner

@mwarkentin mwarkentin Jan 30, 2018

Choose a reason for hiding this comment

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

@jamesmallen did this get pushed to this branch? I don't see the update on the PR.

Not sure if it's a Github issue or what.

@jmaroeder
Copy link
Contributor Author

I accidentally pushed to a different branch. Everything should be fixed (in the correct branch!) in 446c889

@mwarkentin
Copy link
Owner

@jamesmallen Sorry, one more update if possible - could you update the sample project with the required configuration to make this endpoint available at http://127.0.0.1:8000/watchman/bare/ or similar? And then add a corresponding example in the readme?

@mwarkentin
Copy link
Owner

If you’re not sure how to do this, let me know and I can take care of it.

@jmaroeder
Copy link
Contributor Author

Sure thing. Added it in ae48537

@mwarkentin mwarkentin merged commit 806e2e9 into mwarkentin:master Jan 31, 2018
@mwarkentin mwarkentin added this to the 0.15 milestone Jan 31, 2018
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