Merge pull request #79000 from pswica/415

kubectl config set hangs on some invalid property names #415
This commit is contained in:
Kubernetes Prow Robot 2019-06-15 08:52:51 -07:00 committed by GitHub
commit af9d54db76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -76,6 +76,8 @@ func newNavigationSteps(path string) (*navigationSteps, error) {
steps = append(steps, navigationStep{nextPart, fieldType})
currPartIndex += len(strings.Split(nextPart, "."))
currType = fieldType
default:
return nil, fmt.Errorf("unable to parse one or more field values of %v", path)
}
}

View File

@ -72,6 +72,18 @@ func TestParseWithBadValue(t *testing.T) {
test.run(t)
}
func TestParseWithNoMatchingValue(t *testing.T) {
test := stepParserTest{
path: "users.jheiss.exec.command",
expectedNavigationSteps: navigationSteps{
steps: []navigationStep{},
},
expectedError: "unable to parse one or more field values of users.jheiss.exec",
}
test.run(t)
}
func (test stepParserTest) run(t *testing.T) {
actualSteps, err := newNavigationSteps(test.path)
if len(test.expectedError) != 0 {