Merge pull request #79968 from sukeesh/improveNoResource

Flush out current namespace when resources are not found
This commit is contained in:
Kubernetes Prow Robot 2019-07-10 22:58:54 -07:00 committed by GitHub
commit 12c5e2037e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -575,7 +575,8 @@ func (o *GetOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
w.Flush()
if trackingWriter.Written == 0 && !o.IgnoreNotFound && len(allErrs) == 0 {
// if we wrote no output, and had no errors, and are not ignoring NotFound, be sure we output something
fmt.Fprintln(o.ErrOut, "No resources found.")
noResourcesFoundFormat := fmt.Sprintf("No resources found in %s namespace.", o.Namespace)
fmt.Fprintln(o.ErrOut, noResourcesFoundFormat)
}
return utilerrors.NewAggregate(allErrs)
}

View File

@ -513,7 +513,7 @@ func TestGetEmptyTable(t *testing.T) {
if e, a := expected, buf.String(); e != a {
t.Errorf("expected\n%v\ngot\n%v", e, a)
}
expectedErr := `No resources found.
expectedErr := `No resources found in test namespace.
`
if e, a := expectedErr, errbuf.String(); e != a {
t.Errorf("expectedErr\n%v\ngot\n%v", e, a)