Skip to content

Commit 785f9e1

Browse files
committed
Fix kubeconfig flakes
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com> Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
1 parent 9e4e256 commit 785f9e1

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

providers/kubeconfig/provider_test.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ var _ = Describe("Provider Namespace", Ordered, func() {
209209
})
210210

211211
It("runs the reconciler for existing objects", func(ctx context.Context) {
212-
Eventually(func(g Gomega) string {
212+
Eventually(func(g Gomega) {
213213
lion := &corev1.ConfigMap{}
214214
err := zooCli.Get(ctx, client.ObjectKey{Namespace: "zoo", Name: "lion"}, lion)
215215
g.Expect(err).NotTo(HaveOccurred())
216-
return lion.Data["stomach"]
217-
}, "10s").Should(Equal("food"))
216+
g.Expect(lion.Data["stomach"]).To(Equal("food"))
217+
}, "10s")
218218
})
219219

220220
It("runs the reconciler for new objects", func(ctx context.Context) {
@@ -223,12 +223,12 @@ var _ = Describe("Provider Namespace", Ordered, func() {
223223
Expect(err).NotTo(HaveOccurred())
224224
})
225225

226-
Eventually(func(g Gomega) string {
226+
Eventually(func(g Gomega) {
227227
tiger := &corev1.ConfigMap{}
228228
err := zooCli.Get(ctx, client.ObjectKey{Namespace: "zoo", Name: "tiger"}, tiger)
229229
g.Expect(err).NotTo(HaveOccurred())
230-
return tiger.Data["stomach"]
231-
}, "10s").Should(Equal("food"))
230+
g.Expect(tiger.Data["stomach"]).To(Equal("food"))
231+
}, "10s")
232232
})
233233

234234
It("runs the reconciler for updated objects", func(ctx context.Context) {
@@ -243,24 +243,25 @@ var _ = Describe("Provider Namespace", Ordered, func() {
243243
})
244244
Expect(err).NotTo(HaveOccurred())
245245
})
246-
rv, err := strconv.ParseInt(updated.ResourceVersion, 10, 64)
246+
origRv, err := strconv.ParseInt(updated.ResourceVersion, 10, 64)
247247
Expect(err).NotTo(HaveOccurred())
248248

249-
Eventually(func(g Gomega) int64 {
249+
Eventually(func(g Gomega) {
250250
elephant := &corev1.ConfigMap{}
251251
err := zooCli.Get(ctx, client.ObjectKey{Namespace: "zoo", Name: "elephant"}, elephant)
252252
g.Expect(err).NotTo(HaveOccurred())
253253
rv, err := strconv.ParseInt(elephant.ResourceVersion, 10, 64)
254254
g.Expect(err).NotTo(HaveOccurred())
255-
return rv
256-
}, "10s").Should(BeNumerically(">=", rv))
255+
g.Expect(rv).To(BeNumerically(">=", origRv))
256+
}, "10s")
257257

258258
Eventually(func(g Gomega) string {
259259
elephant := &corev1.ConfigMap{}
260260
err := zooCli.Get(ctx, client.ObjectKey{Namespace: "zoo", Name: "elephant"}, elephant)
261261
g.Expect(err).NotTo(HaveOccurred())
262+
g.Expect(elephant.Data["stomach"]).To(Equal("food"))
262263
return elephant.Data["stomach"]
263-
}, "10s").Should(Equal("food"))
264+
}, "10s")
264265
})
265266

266267
It("queries one cluster via a multi-cluster index", func() {
@@ -292,12 +293,12 @@ var _ = Describe("Provider Namespace", Ordered, func() {
292293
err = jungleCli.Create(ctx, &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "jungle", Name: "dog", Labels: map[string]string{"type": "animal"}}})
293294
Expect(err).NotTo(HaveOccurred())
294295

295-
Eventually(func(g Gomega) string {
296+
Eventually(func(g Gomega) {
296297
dog := &corev1.ConfigMap{}
297298
err := jungleCli.Get(ctx, client.ObjectKey{Namespace: "jungle", Name: "dog"}, dog)
298299
g.Expect(err).NotTo(HaveOccurred())
299-
return dog.Data["stomach"]
300-
}, "10s").Should(Equal("food"))
300+
g.Expect(dog.Data["stomach"]).To(Equal("food"))
301+
}, "10s")
301302
})
302303

303304
It("reconciles objects when kubeconfig secret is updated without changing the cluster", func() {
@@ -314,12 +315,12 @@ var _ = Describe("Provider Namespace", Ordered, func() {
314315
err = jungleCli.Create(ctx, &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: "jungle", Name: "leopard", Labels: map[string]string{"type": "animal"}}})
315316
Expect(err).NotTo(HaveOccurred())
316317

317-
Eventually(func(g Gomega) string {
318+
Eventually(func(g Gomega) {
318319
leopard := &corev1.ConfigMap{}
319320
err := jungleCli.Get(ctx, client.ObjectKey{Namespace: "jungle", Name: "leopard"}, leopard)
320321
g.Expect(err).NotTo(HaveOccurred())
321-
return leopard.Data["stomach"]
322-
}, "10s").Should(Equal("food"))
322+
g.Expect(leopard.Data["stomach"]).To(Equal("food"))
323+
}, "10s")
323324
})
324325

325326
It("removes a cluster from the provider when the kubeconfig secret is deleted", func() {

0 commit comments

Comments
 (0)