Fixed misleading error message when a resource with no selector or name is provided to kubectl delete or label command

This commit is contained in:
amehdy
2016-05-14 02:04:35 -07:00
parent 667f586083
commit 0c5713084b
3 changed files with 67 additions and 0 deletions

View File

@@ -295,6 +295,18 @@ func TestLabelErrors(t *testing.T) {
args: []string{"pods=bar"},
errFn: func(err error) bool { return strings.Contains(err.Error(), "one or more resources must be specified") },
},
"resources but no selectors": {
args: []string{"pods", "app=bar"},
errFn: func(err error) bool {
return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified")
},
},
"multiple resources but no selectors": {
args: []string{"pods,deployments", "app=bar"},
errFn: func(err error) bool {
return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified")
},
},
}
for k, testCase := range testCases {