test: improve TestMultiClusterAllocationFromLocal flakiness.#4350
Conversation
Not sure that I fixed it, but made some improvements and added some extra logging as well: - Change assert.NoError to require.NoError to stop test execution on allocation failure - Add error wrapping with response body context in executeAllocation helper - Fix createRequest to check error before setting headers - Add Accept header to allocation requests
|
Build Succeeded 🥳 Build Id: 0a26512b-9379-434a-a064-67e8d9526c80 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
| } | ||
|
|
||
| r.Header.Set("Content-Type", k8sruntime.ContentTypeJSON) | ||
| r.Header.Set("Accept", k8sruntime.ContentTypeJSON) |
There was a problem hiding this comment.
Not sure we want this? Either the response is always json (even errors), and we never hit the err = json.Unmarshal(jsn, ret) on line 783, or we expect errors to be in a non-json format like a plain text stack trace, so we want those errors to fall through and get caught and wrapped and returned.
There was a problem hiding this comment.
Not sure we want this? Either the response is always json (even errors), and we never hit the err = json.Unmarshal(jsn, ret) on line 783
It'll still fail, since the format of the error json won't match the struct - and even if it did go through, the result would end up not aligning with the expected result.
The flakiness may be a result of the underlying K8s system thinking sometimes we don't want JSON -- so this is just to make sure that's not the actual issue.
|
Build Succeeded 🥳 Build Id: ec51208d-5c40-48d6-b8ca-088a95f806da The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
…dev#4350) Not sure that I fixed it, but made some improvements and added some extra logging as well: - Change assert.NoError to require.NoError to stop test execution on allocation failure - Add error wrapping with response body context in executeAllocation helper - Fix createRequest to check error before setting headers - Add Accept header to allocation requests
What type of PR is this?
/kind cleanup
What this PR does / Why we need it:
Not sure that I fixed it, but made some improvements and added some extra logging as well:
Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
N/A