Skip to content

Commit f0ba1ae

Browse files
committed
Added test for updated annotation; added timeout for teardown
1 parent 6c3b351 commit f0ba1ae

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pkg/client/client_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var _ = Describe("Client", func() {
7878
scheme.AddKnownTypeWithName(ngvk, node)
7979

8080
close(done)
81-
})
81+
}, serverSideTimeoutSeconds)
8282

8383
var delOptions *metav1.DeleteOptions
8484
AfterEach(func(done Done) {
@@ -100,7 +100,7 @@ var _ = Describe("Client", func() {
100100
Expect(err).NotTo(HaveOccurred())
101101
}
102102
close(done)
103-
})
103+
}, serverSideTimeoutSeconds)
104104

105105
Describe("New", func() {
106106
It("should return a new Client", func(done Done) {
@@ -280,10 +280,11 @@ var _ = Describe("Client", func() {
280280
err = cl.Update(context.TODO(), dep)
281281
Expect(err).NotTo(HaveOccurred())
282282

283-
By("validating updated Deployment exists")
283+
By("validating updated Deployment has new annotation")
284284
actual, err := clientset.AppsV1().Deployments(ns).Get(dep.Name, metav1.GetOptions{})
285285
Expect(err).NotTo(HaveOccurred())
286286
Expect(actual).NotTo(BeNil())
287+
Expect(actual.Annotations["foo"]).To(Equal("bar"))
287288

288289
close(done)
289290
})
@@ -306,10 +307,11 @@ var _ = Describe("Client", func() {
306307
err = cl.Update(context.TODO(), u)
307308
Expect(err).NotTo(HaveOccurred())
308309

309-
By("fetching newly created unstructured Deployment")
310+
By("fetching newly created unstructured Deployment has new annotation")
310311
actual, err := clientset.AppsV1().Deployments(ns).Get(dep.Name, metav1.GetOptions{})
311312
Expect(err).NotTo(HaveOccurred())
312313
Expect(actual).NotTo(BeNil())
314+
Expect(actual.Annotations["foo"]).To(Equal("bar"))
313315

314316
close(done)
315317
})
@@ -327,10 +329,11 @@ var _ = Describe("Client", func() {
327329
err = cl.Update(context.TODO(), node)
328330
Expect(err).NotTo(HaveOccurred())
329331

330-
By("writing the result back to the go struct")
332+
By("validate updated Node had new annotation")
331333
actual, err := clientset.CoreV1().Nodes().Get(node.Name, metav1.GetOptions{})
332334
Expect(err).NotTo(HaveOccurred())
333335
Expect(actual).NotTo(BeNil())
336+
Expect(actual.Annotations["foo"]).To(Equal("bar"))
334337

335338
close(done)
336339
})

0 commit comments

Comments
 (0)