Unverified Commit 45f8017e authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #55283 from spzala/unreachabletest

Automatic merge from submit-queue (batch tested with PRs 55283, 55461, 55288, 53970, 55487). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix an unreachable kubectl explain field lookup test In error case, the condition `gotErr != test.err && gotPath != test.expectedPath` never fulfill because in this case both gotPath and test.expectedPath are always an empty string. So the err “err: `field "what?" does not exist`” doesn’t get tasted. For example, if you change the value of `err:` to anything, the test still will pass. Also, since gotPath is empty string in case of err, in the output error we probably don’t want to display path. **What this PR does / why we need it**: Fixes an unreachable unit test. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note None ```
parents 1418f984 32d8fa00
...@@ -69,9 +69,9 @@ func TestFindField(t *testing.T) { ...@@ -69,9 +69,9 @@ func TestFindField(t *testing.T) {
gotPath = path.GetPath().String() gotPath = path.GetPath().String()
} }
if gotErr != test.err && gotPath != test.expectedPath { if gotErr != test.err || gotPath != test.expectedPath {
t.Errorf("LookupSchemaForField(schema, %v) = (%v, %v), expected (%s, %v)", t.Errorf("LookupSchemaForField(schema, %v) = (path: %q, err: %q), expected (path: %q, err: %q)",
test.path, gotErr, gotPath, test.expectedPath, test.err) test.path, gotPath, gotErr, test.expectedPath, test.err)
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment