Improve state reporting in kube checks#2082
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2082 +/- ##
==========================================
- Coverage 67.36% 67.31% -0.06%
==========================================
Files 215 215
Lines 9111 9092 -19
==========================================
- Hits 6138 6120 -18
+ Misses 2698 2697 -1
Partials 275 275
Continue to review full report at Codecov.
|
| }) | ||
|
|
||
| if waitErr != nil { | ||
| return fmt.Errorf("deployment %q is not in desired state, got: %+v: %w", name, lastState, waitErr) |
There was a problem hiding this comment.
Should we print the big structs via spew.Sprint. It resolves pointers and stuff. We use that in Serving wherever actual debugging output of full K8s resources is necessary.
|
|
||
| if waitErr != nil { | ||
| return fmt.Errorf("deployment %q is not in desired state, got: %+v: %w", name, lastState, waitErr) | ||
| return errors.New(spew.Sprintf("deployment %q is not in desired state, got: %+v: %w", name, lastState, waitErr)) |
There was a problem hiding this comment.
Why move away from Errorf here? I'd have kept that and would propose:
return fmt.Errorf("deployment %q is not in desired state, error: %w, state:\n%s", name, waitErr spew.Sprint(lastState))There was a problem hiding this comment.
Why not? It is another way to do it. It covers all other arguments too without thinking too much about them (their size etc). Anyway I can change.
There was a problem hiding this comment.
I think I could have used spew.Errorf() to have only one call if I want to make spew parse all arguments btw.
|
|
|
/retest |
1 similar comment
|
/retest |
|
@markusthoemmes gentle ping. The test keeps failing but it is unrelated I have a PR to fix that infamous test here #2088 . |
|
@markusthoemmes gentle ping for a merge. |
markusthoemmes
left a comment
There was a problem hiding this comment.
LGTM apart from the nits. The only important one I believe is the logs output.
| return strings.Contains(string(logs), content), nil | ||
| }) | ||
| if waitErr != nil { | ||
| return fmt.Errorf("logs do not contain the desired content %q, got %q: %w", content, logs, waitErr) |
There was a problem hiding this comment.
| return fmt.Errorf("logs do not contain the desired content %q, got %q: %w", content, logs, waitErr) | |
| return fmt.Errorf("logs do not contain the desired content %q, got %q: %w", content, string(logs), waitErr) |
I believe this gets us a messy byte output otherwise.
There was a problem hiding this comment.
Oh wow interesting!
| }) | ||
|
|
||
| if waitErr != nil { | ||
| return fmt.Errorf("pod %q is not in desired state, got: %+v: %w", name, spew.Sprint(lastState), waitErr) |
There was a problem hiding this comment.
| return fmt.Errorf("pod %q is not in desired state, got: %+v: %w", name, spew.Sprint(lastState), waitErr) | |
| return fmt.Errorf("pod %q is not in desired state, got: %s: %w", name, spew.Sprint(lastState), waitErr) |
just a nit, but for completeness sake.
| }) | ||
|
|
||
| if waitErr != nil { | ||
| return fmt.Errorf("pod list is not in desired state, got: %+v: %w", spew.Sprint(lastState), waitErr) |
There was a problem hiding this comment.
| return fmt.Errorf("pod list is not in desired state, got: %+v: %w", spew.Sprint(lastState), waitErr) | |
| return fmt.Errorf("pod list is not in desired state, got: %s: %w", spew.Sprint(lastState), waitErr) |
| }) | ||
|
|
||
| if waitErr != nil { | ||
| return fmt.Errorf("deployment %q is not in desired state, got: %+v: %w", name, spew.Sprint(lastState), waitErr) |
There was a problem hiding this comment.
| return fmt.Errorf("deployment %q is not in desired state, got: %+v: %w", name, spew.Sprint(lastState), waitErr) | |
| return fmt.Errorf("deployment %q is not in desired state, got: %s: %w", name, spew.Sprint(lastState), waitErr) |
|
/assign Please assign me if you want a review, i'll see it pop up in my Github state. |
|
/assign @markusthoemmes |
|
/lgtm |
|
@markusthoemmes gentle ping. |
markusthoemmes
left a comment
There was a problem hiding this comment.
/lgtm
/approve
The PR won't merge without the unit test passing though
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: markusthoemmes The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
Changes
Fixes #996