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