@@ -1686,6 +1686,36 @@ var _ = Describe("Client", func() {
16861686 close (done )
16871687 }, serverSideTimeoutSeconds )
16881688
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+
16891719 It ("should return an empty list if there are no matching objects" , func (done Done ) {
16901720 cl , err := client .New (cfg , client.Options {})
16911721 Expect (err ).NotTo (HaveOccurred ())
0 commit comments