@@ -44,6 +44,7 @@ import (
4444
4545var _ = Describe ("NamespacedClient" , func () {
4646 var dep * appsv1.Deployment
47+ var nameSpace * corev1.Namespace
4748 var acDep * appsv1applyconfigurations.DeploymentApplyConfiguration
4849 var ns = "default"
4950 var count uint64 = 0
@@ -83,6 +84,12 @@ var _ = Describe("NamespacedClient", func() {
8384 },
8485 },
8586 }
87+ nameSpace = & corev1.Namespace {
88+ ObjectMeta : metav1.ObjectMeta {
89+ Name : fmt .Sprintf ("namespace-%v" , count ),
90+ Labels : map [string ]string {"name" : fmt .Sprintf ("namespace-%v" , count )},
91+ },
92+ }
8693 acDep = appsv1applyconfigurations .Deployment (dep .Name , "" ).
8794 WithLabels (dep .Labels ).
8895 WithSpec (appsv1applyconfigurations .DeploymentSpec ().
@@ -134,10 +141,13 @@ var _ = Describe("NamespacedClient", func() {
134141 var err error
135142 dep , err = clientset .AppsV1 ().Deployments (ns ).Create (ctx , dep , metav1.CreateOptions {})
136143 Expect (err ).NotTo (HaveOccurred ())
144+ nameSpace , err = clientset .CoreV1 ().Namespaces ().Create (ctx , nameSpace , metav1.CreateOptions {})
145+ Expect (err ).NotTo (HaveOccurred ())
137146 })
138147
139148 AfterEach (func (ctx SpecContext ) {
140149 deleteDeployment (ctx , dep , ns )
150+ deleteNamespace (ctx , nameSpace )
141151 })
142152
143153 It ("should successfully List objects when namespace is not specified with the object" , func (ctx SpecContext ) {
@@ -150,7 +160,7 @@ var _ = Describe("NamespacedClient", func() {
150160 })
151161
152162 It ("should successfully List objects when object is not namespaced scoped" , func (ctx SpecContext ) {
153- result := & corev1.NodeList {}
163+ result := & corev1.NamespaceList {}
154164 opts := & client.ListOptions {}
155165 Expect (getClient ().List (ctx , result , opts )).NotTo (HaveOccurred ())
156166 Expect (result .Items ).NotTo (BeEmpty ())
0 commit comments