-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cmctl renew
flags validation
#20
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,12 +41,18 @@ func TestValidate(t *testing.T) { | |
args: []string{"abc"}, | ||
expErr: true, | ||
}, | ||
"If there are arguments, as well as --all-namespaces, error": { | ||
options: &Options{ | ||
AllNamespaces: true, | ||
}, | ||
args: []string{"abc"}, | ||
expErr: true, | ||
}, | ||
"If there are all certificates selected, as well as label selector, error": { | ||
options: &Options{ | ||
LabelSelector: "foo=bar", | ||
All: true, | ||
}, | ||
args: []string{""}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a minor bug in the test case, as providing |
||
expErr: true, | ||
}, | ||
"If there are all certificates selected, as well as arguments, error": { | ||
|
@@ -63,14 +69,14 @@ func TestValidate(t *testing.T) { | |
}, | ||
expErr: false, | ||
}, | ||
"If --namespace and --all namespace specified, error": { | ||
"If --namespace and --all specified, don't error": { | ||
options: &Options{ | ||
All: true, | ||
}, | ||
setStringFlags: []stringFlag{ | ||
{name: "namespace", value: "foo"}, | ||
}, | ||
expErr: true, | ||
Comment on lines
-66
to
-73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case doesn't seem right, as looking at the description for I've updated the validation function accordingly too. |
||
expErr: false, | ||
}, | ||
"If --namespace specified without arguments, error": { | ||
options: &Options{}, | ||
|
@@ -95,6 +101,29 @@ func TestValidate(t *testing.T) { | |
}, | ||
expErr: false, | ||
}, | ||
"If --label-selector specified with --all, error": { | ||
options: &Options{ | ||
LabelSelector: "foo=bar", | ||
All: true, | ||
}, | ||
expErr: true, | ||
}, | ||
"If --label-selector specified with --all-namespaces, don't error": { | ||
options: &Options{ | ||
AllNamespaces: true, | ||
LabelSelector: "foo=bar", | ||
}, | ||
expErr: false, | ||
}, | ||
"If --label-selector specified with --namespace, don't error": { | ||
options: &Options{ | ||
LabelSelector: "foo=bar", | ||
}, | ||
setStringFlags: []stringFlag{ | ||
{name: "namespace", value: "foo"}, | ||
}, | ||
expErr: false, | ||
}, | ||
} | ||
|
||
for name, test := range tests { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If arguments are specified:
Error from server (NotFound):
error with--all-namespaces
, unless the first namespace that is listed happens to contain the certificate(s) specified in the arguments.--all-namespaces
; arguments should really only be used with--namespace
.