-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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 healthz checkerNames test so that it tests against the expected output #70753
Conversation
/sig api-machinery |
3eb55e8
to
924af0d
Compare
924af0d
to
b8b1ffe
Compare
@@ -148,10 +148,32 @@ func TestCheckerNames(t *testing.T) { | |||
for _, tc := range testCases { | |||
result := checkerNames(tc.have...) | |||
t.Run(tc.desc, func(t *testing.T) { | |||
if reflect.DeepEqual(tc.want, result) { | |||
if !reflect.DeepEqual(tc.want, result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice spot :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow
@@ -187,14 +187,20 @@ func adaptCheckToHandler(c func(r *http.Request) error) http.HandlerFunc { | |||
|
|||
// checkerNames returns the names of the checks in the same order as passed in. | |||
func checkerNames(checks ...HealthzChecker) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we use checkerNames
now. Maybe just rename the function to formatCheckerNames
but keep the existing code, and change the comment to say that we are formatting them for printing/debugging...
|
||
func TestFormatCheckerNames(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just fix the existing test so add the quotes (and so that it actually checks correctly ;-) ). This just looks like a debug helper function, so the tests are already a little disproportionate...
Nice find. As checkerNames is only used in this one spot, I think it's probably better to enforce that (the rename to formatCheckerNames looks like a good one to help people), and just to fix the test to expect quoted values. /ok-to-test |
You reminded me that you wanted to use this function elsewhere! /lgtm |
b8b1ffe
to
95417ec
Compare
95417ec
to
0623f63
Compare
/lgtm |
/test pull-kubernetes-e2e-gce-100-performance |
/approve nice catch |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lavalamp, logicalhan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fixes a test which is not currently testing expectations correctly. This test should be failing but is not since the assertion logic is flipped. This PR unflips the logic (fixing the test), refactors out some formatting functionality and adds a test for that.
Which issue(s) this PR fixes:
Fixes #70752