@@ -1986,6 +1986,36 @@ var _ = Describe("Client", func() {
1986
1986
close (done )
1987
1987
}, serverSideTimeoutSeconds )
1988
1988
1989
+ It ("should fetch unstructured collection of objects, even if scheme is empty" , func (done Done ) {
1990
+ By ("create an initial object" )
1991
+ _ , err := clientset .AppsV1 ().Deployments (ns ).Create (dep )
1992
+ Expect (err ).NotTo (HaveOccurred ())
1993
+
1994
+ cl , err := client .New (cfg , client.Options {Scheme : runtime .NewScheme ()})
1995
+ Expect (err ).NotTo (HaveOccurred ())
1996
+
1997
+ By ("listing all objects of that type in the cluster" )
1998
+ deps := & unstructured.UnstructuredList {}
1999
+ deps .SetGroupVersionKind (schema.GroupVersionKind {
2000
+ Group : "apps" ,
2001
+ Kind : "DeploymentList" ,
2002
+ Version : "v1" ,
2003
+ })
2004
+ err = cl .List (context .Background (), deps )
2005
+ Expect (err ).NotTo (HaveOccurred ())
2006
+
2007
+ Expect (deps .Items ).NotTo (BeEmpty ())
2008
+ hasDep := false
2009
+ for _ , item := range deps .Items {
2010
+ if item .GetName () == dep .Name && item .GetNamespace () == dep .Namespace {
2011
+ hasDep = true
2012
+ break
2013
+ }
2014
+ }
2015
+ Expect (hasDep ).To (BeTrue ())
2016
+ close (done )
2017
+ }, serverSideTimeoutSeconds )
2018
+
1989
2019
It ("should return an empty list if there are no matching objects" , func (done Done ) {
1990
2020
cl , err := client .New (cfg , client.Options {})
1991
2021
Expect (err ).NotTo (HaveOccurred ())
0 commit comments