mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
kubectl config set hangs on some invalid property names #415
This commit is contained in:
parent
333081e79c
commit
ae386f3143
@ -76,6 +76,8 @@ func newNavigationSteps(path string) (*navigationSteps, error) {
|
|||||||
steps = append(steps, navigationStep{nextPart, fieldType})
|
steps = append(steps, navigationStep{nextPart, fieldType})
|
||||||
currPartIndex += len(strings.Split(nextPart, "."))
|
currPartIndex += len(strings.Split(nextPart, "."))
|
||||||
currType = fieldType
|
currType = fieldType
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unable to parse one or more field values of %v", path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,18 @@ func TestParseWithBadValue(t *testing.T) {
|
|||||||
test.run(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) {
|
func (test stepParserTest) run(t *testing.T) {
|
||||||
actualSteps, err := newNavigationSteps(test.path)
|
actualSteps, err := newNavigationSteps(test.path)
|
||||||
if len(test.expectedError) != 0 {
|
if len(test.expectedError) != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user