-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix(apiChecks): For status code >399 checks should fail #19
Conversation
We're automatically determining if the `shouldFail` boolean should be true or false based on the expected status code, if it's <400 then it's false, if it's >=400, then it's true.
@akosveres the code looks good to me but I am not sure about this change. Can I ask why you think is this better than rather set the value manually? |
The pattern I've seen is that anything expected above 400 is an expected failure for us. Do you have any example when it is not? |
No, I guess that part is correct but I am not entirely getting when this |
The way I understood the logic is:
Is the above assumption wrong? If it isn't, then this is what I based my work on, the important part is the expected status code, if I'm expecting 403, but the host behind the proxy does not exist, it will get a 404, the check will fail and alerts will be sent out. If the authentication does not work, then a 200 might occur, the check will fail and the alert will be sent out. |
To explain the logic a bit more: The expected status code is inspected, if it's bellow 400, then shouldFail is automatically false, if it is above, it's true. This is done when we construct the checkly check spec before sending it to the checklyhq API. It's the same for create and update. Update is needed as someone can update the expected status code so we need to re-determine if shouldFail should be false or true. |
@akosveres, I am still not 100% sure about this, but I think it is good to go. You are the ones using the operator, I believe you have a good use case behind this 👌 |
Okay, let's chat more about it and we can always remove this logic in the future. |
🎉 This PR is included in version 1.2.5 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
We're automatically determining if the
shouldFail
boolean should betrue or false based on the expected status code, if it's <400 then it's
false, if it's >=400, then it's true.