-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat/tests: tests for error handling & metrics in admin endpoints #6805
feat/tests: tests for error handling & metrics in admin endpoints #6805
Conversation
80816c6
to
704394d
Compare
Thanks for the PR! Maybe @mohammed90 or @hairyhenderson would be suitable for reviewing this if they have a few minutes. 👍 |
- TestAdminHandlerErrorHandling - Tests the handler.handleError() functionality by directly verifying error response formatting - TestAdminHandlerBuiltinRouteErrors - Tests the error handling pathway by using real admin server routes and verifying both error responses and prometheus metrics increments - provisionAdminRouters: add unit tests for admin handler registration and routing for admin.api - TestAllowedOriginsUnixSocket: checks unix socket with default origins are added - TestReplaceRemoteAdminServer: test for replaceRemoteAdminServer with certificate validation, custom origins and cleanup
6364add
to
cacbe17
Compare
@mholt @mohammed90 Just pushed a couple more tests for admin. Please review the same and let me know if any fixes are required. Thanks :) |
4486cb9
to
6138fe1
Compare
6138fe1
to
cc504eb
Compare
@mholt @mohammed90 gentle reminder to review this PR. Would love to see this merged as it is my first open source contribution after a long time :) |
We're glad for the contribution, thank you! I've just been very busy. I haven't reviewed the change super thoroughly, but it looks acceptable at a glance. Generally, we welcome more tests! |
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.
Thank you for the PR -- sorry again for the wait. Welcome back to open source, then!
We'll get this merged momentarily.
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.
Thanks for adding the tests! They seem good.
functionality by directly verifying error response formatting
handling pathway by using real admin server routes and verifying
both error responses and prometheus metrics increments
this increases the test coverage of admin.go from 31% to 59%.
Increases total coverage from 37.9% to 47%.
I added this PR as a way to learn more about caddy's codebase and to contribute to caddy. I'd love to contribute more of these tests if such contributions are welcome.