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
[e2e] Tests should check status code before attempting to unmarshal into json #6777
Comments
Hey, is this issue solved yet? |
hi @PrinsonF77 , I'm going to say no just based on the fact that this is Open, still in the Backlog there are no PRs... Did you want to contribute here? |
Yes. Can you assign it to me? |
Thanks, @PrinsonF77 ! @nrfox , please provide any guidance, thanks. |
Sure the issue is here inside of the kiali/tests/integration/utils/kiali/kiali_client.go Lines 605 to 616 in 9cb961f
Until we check the status code, we can't safely unmarshal into What we need is to stop unmarshaling non-200 responses inside of the client calls. It looks like some tests still need to check the status code so I wouldn't return an error here for non-200 responses. It doesn't appear that anything uses the response body directly though so you can simply log the string of |
Thanks for the explanation. Will start working on it |
@PrinsonF77 Will you be completing this effort? |
The kiali client methods can now use this method: kiali/tests/integration/utils/kiali/kiali_client.go Lines 647 to 663 in 470b68b
|
Hey @jshaughn @nrfox . Will be taking this up. Sorry for the delay. |
@PrinsonF77 I would say just update the methods that don't return a status code to use that |
@nrfox Most of the kiali client methods return a status code. Even the Grafana method that was given as an example in #6777 (comment) .
I think this would allow for most of the kiali client methods to be rewritten in this way which reduces the redundancy and helps with returning better error messages. This won't affect any methods that return status codes. |
getRequestAndUnmarshalInto to avoid masking of errors returned by the server (kiali#6777)
That sounds good. |
Closing on merge of #7215 |
Many e2e tests attempt to unmarshal the kiali api response before checking the status code resulting in an unmarshalling error. This can mask the response from the server making it harder to debug the tests. The status code should first be checked before unmarshalling.
See: https://github.com/kiali/kiali/actions/runs/6413559944/job/18045431679 for an example of the error.
The text was updated successfully, but these errors were encountered: