Skip to content

Commit

Permalink
kubectl config set hangs on some invalid property names #415
Browse files Browse the repository at this point in the history
  • Loading branch information
pswica committed Jun 14, 2019
1 parent 333081e commit ae386f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/kubectl/cmd/config/navigation_step_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
12 changes: 12 additions & 0 deletions pkg/kubectl/cmd/config/navigation_step_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ae386f3

Please sign in to comment.