mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
flush current namespace when resources are not found
This commit is contained in:
parent
88808aa89f
commit
b7d2478ac9
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user