@@ -591,6 +591,32 @@ func TestNoBlankLinesForGetAll(t *testing.T) {
591
591
}
592
592
}
593
593
594
+ func TestNotFoundMessageForGetNonNamespacedResources (t * testing.T ) {
595
+ tf := cmdtesting .NewTestFactory ().WithNamespace ("test" )
596
+ defer tf .Cleanup ()
597
+
598
+ codec := scheme .Codecs .LegacyCodec (scheme .Scheme .PrioritizedVersionsAllGroups ()... )
599
+ tf .UnstructuredClient = & fake.RESTClient {
600
+ NegotiatedSerializer : resource .UnstructuredPlusDefaultContentConfig ().NegotiatedSerializer ,
601
+ Resp : & http.Response {StatusCode : http .StatusOK , Header : cmdtesting .DefaultHeader (), Body : emptyTableObjBody (codec )},
602
+ }
603
+
604
+ streams , _ , buf , errbuf := genericclioptions .NewTestIOStreams ()
605
+ cmd := NewCmdGet ("kubectl" , tf , streams )
606
+ cmd .SetOutput (buf )
607
+ cmd .Run (cmd , []string {"persistentvolumes" })
608
+
609
+ expected := ``
610
+ if e , a := expected , buf .String (); e != a {
611
+ t .Errorf ("expected\n %v\n got\n %v" , e , a )
612
+ }
613
+ expectedErr := `No resources found
614
+ `
615
+ if e , a := expectedErr , errbuf .String (); e != a {
616
+ t .Errorf ("expectedErr\n %v\n got\n %v" , e , a )
617
+ }
618
+ }
619
+
594
620
func TestGetObjectsShowLabels (t * testing.T ) {
595
621
pods , _ , _ := cmdtesting .TestData ()
596
622
0 commit comments