@@ -1686,6 +1686,36 @@ var _ = Describe("Client", func() {
1686
1686
close (done )
1687
1687
}, serverSideTimeoutSeconds )
1688
1688
1689
+ It ("should fetch unstructured collection of objects, even if scheme is empty" , func (done Done ) {
1690
+ By ("create an initial object" )
1691
+ _ , err := clientset .AppsV1 ().Deployments (ns ).Create (ctx , dep , metav1.CreateOptions {})
1692
+ Expect (err ).NotTo (HaveOccurred ())
1693
+
1694
+ cl , err := client .New (cfg , client.Options {Scheme : runtime .NewScheme ()})
1695
+ Expect (err ).NotTo (HaveOccurred ())
1696
+
1697
+ By ("listing all objects of that type in the cluster" )
1698
+ deps := & unstructured.UnstructuredList {}
1699
+ deps .SetGroupVersionKind (schema.GroupVersionKind {
1700
+ Group : "apps" ,
1701
+ Kind : "DeploymentList" ,
1702
+ Version : "v1" ,
1703
+ })
1704
+ err = cl .List (context .Background (), deps )
1705
+ Expect (err ).NotTo (HaveOccurred ())
1706
+
1707
+ Expect (deps .Items ).NotTo (BeEmpty ())
1708
+ hasDep := false
1709
+ for _ , item := range deps .Items {
1710
+ if item .GetName () == dep .Name && item .GetNamespace () == dep .Namespace {
1711
+ hasDep = true
1712
+ break
1713
+ }
1714
+ }
1715
+ Expect (hasDep ).To (BeTrue ())
1716
+ close (done )
1717
+ }, serverSideTimeoutSeconds )
1718
+
1689
1719
It ("should return an empty list if there are no matching objects" , func (done Done ) {
1690
1720
cl , err := client .New (cfg , client.Options {})
1691
1721
Expect (err ).NotTo (HaveOccurred ())
0 commit comments