Fixes unit tests when default kubeconfig namespace is not "default" (#4825)

Use defaultNamespace from kubeconfig context

Fixes #4779

Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
This commit is contained in:
Rajat Jindal 2020-08-03 23:57:02 +05:30 committed by GitHub
parent 1825dd5291
commit cbcc305b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -742,7 +742,7 @@ func (o *statOptions) validateConflictingFlags() error {
return fmt.Errorf("--to-namespace and --from-namespace flags are mutually exclusive")
}
if o.allNamespaces && o.namespace != "default" {
if o.allNamespaces && o.namespace != defaultNamespace {
return fmt.Errorf("--all-namespaces and --namespace flags are mutually exclusive")
}
@ -760,9 +760,9 @@ func (o *statOptions) validateNamespaceFlags() error {
return fmt.Errorf("--from-namespace flag is incompatible with namespace resource type")
}
// Note: technically, this allows you to say `stat ns --namespace default`, but that
// Note: technically, this allows you to say `stat ns --namespace <default-namespace-from-kubectl-context>`, but that
// seems like an edge case.
if o.namespace != "default" {
if o.namespace != defaultNamespace {
return fmt.Errorf("--namespace flag is incompatible with namespace resource type")
}