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

feat(api): test endpoint that throws an exception #919

Merged
merged 6 commits into from
Mar 27, 2020

Conversation

lorin
Copy link
Contributor

@lorin lorin commented Mar 25, 2020

Add a /test/errorendpoint that throws an exception (and, consequently, returns a 500 error) when hit.

This is intended to assist in testing error alerts, by giving us a reliable way to induce errors.

path = ["/error"],
produces = [APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE]
)
fun throwAnException(): String {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be useful to support different types of exceptions/status codes? If so, you could add a parameter with the desired status code and throw an exception you know would cause that code to be returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think it's potentially useful to support simulations of different kinds of errors, and I'd like to hold off on adding this functionality until we have tests that are consuming them (this meets my current testing needs for the exception alerts).

@lorin
Copy link
Contributor Author

lorin commented Mar 26, 2020

My test is failing because I have to enable the new tests.error-simulation property to get it to work. Working on that now.

Lorin Hochstein added 4 commits March 26, 2020 16:51
Add a /test/error endpoint that throws an exception (returns 500 error)
when hit.

This is intended to assist in testing error alerts, by giving us
a reliable way to induce errors.
Copy link
Contributor

@gal-yardeni gal-yardeni left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for addressing our comments.

@luispollo luispollo added the ready to merge Approved and ready for merge label Mar 27, 2020
@mergify mergify bot added the auto merged label Mar 27, 2020
@mergify mergify bot merged commit deee23a into spinnaker:master Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged ready to merge Approved and ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants