@@ -43,6 +43,7 @@ import (
4343
4444var _ = Describe ("NamespacedClient" , func () {
4545 var dep * appsv1.Deployment
46+ var nameSpace * corev1.Namespace
4647 var acDep * appsv1applyconfigurations.DeploymentApplyConfiguration
4748 var ns = "default"
4849 var count uint64 = 0
@@ -82,6 +83,12 @@ var _ = Describe("NamespacedClient", func() {
8283 },
8384 },
8485 }
86+ nameSpace = & corev1.Namespace {
87+ ObjectMeta : metav1.ObjectMeta {
88+ Name : fmt .Sprintf ("namespace-%v" , count ),
89+ Labels : map [string ]string {"name" : fmt .Sprintf ("namespace-%v" , count )},
90+ },
91+ }
8592 acDep = appsv1applyconfigurations .Deployment (dep .Name , "" ).
8693 WithLabels (dep .Labels ).
8794 WithSpec (appsv1applyconfigurations .DeploymentSpec ().
@@ -133,10 +140,13 @@ var _ = Describe("NamespacedClient", func() {
133140 var err error
134141 dep , err = clientset .AppsV1 ().Deployments (ns ).Create (ctx , dep , metav1.CreateOptions {})
135142 Expect (err ).NotTo (HaveOccurred ())
143+ nameSpace , err = clientset .CoreV1 ().Namespaces ().Create (ctx , nameSpace , metav1.CreateOptions {})
144+ Expect (err ).NotTo (HaveOccurred ())
136145 })
137146
138147 AfterEach (func (ctx SpecContext ) {
139148 deleteDeployment (ctx , dep , ns )
149+ deleteNamespace (ctx , nameSpace )
140150 })
141151
142152 It ("should successfully List objects when namespace is not specified with the object" , func (ctx SpecContext ) {
@@ -149,7 +159,7 @@ var _ = Describe("NamespacedClient", func() {
149159 })
150160
151161 It ("should successfully List objects when object is not namespaced scoped" , func (ctx SpecContext ) {
152- result := & corev1.NodeList {}
162+ result := & corev1.NamespaceList {}
153163 opts := & client.ListOptions {}
154164 Expect (getClient ().List (ctx , result , opts )).NotTo (HaveOccurred ())
155165 Expect (result .Items ).NotTo (BeEmpty ())
0 commit comments