Skip to content

Commit efe2fe9

Browse files
author
bowenislandsong
committed
fix for should have deleted the dependent since both the owners were deleted
1 parent 75ede5e commit efe2fe9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/e2e/gc_e2e_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var _ = Describe("Dependant garbage collection", func() {
223223
_, err = kubeClient.KubernetesInterface().CoreV1().ConfigMaps(testNamespace).Create(context.TODO(), dependent, metav1.CreateOptions{})
224224
Expect(err).NotTo(HaveOccurred(), "dependent could not be created")
225225

226-
propagation = "Foreground"
226+
propagation = metav1.DeletePropagationForeground
227227
options = metav1.DeleteOptions{PropagationPolicy: &propagation}
228228
})
229229

@@ -238,7 +238,7 @@ var _ = Describe("Dependant garbage collection", func() {
238238
Eventually(func() error {
239239
_, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(testNamespace).Get(context.TODO(), ownerA.GetName(), metav1.GetOptions{})
240240
return err
241-
}).ShouldNot(HaveOccurred())
241+
}).Should(HaveOccurred())
242242

243243
})
244244

@@ -262,7 +262,7 @@ var _ = Describe("Dependant garbage collection", func() {
262262
Eventually(func() error {
263263
_, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(testNamespace).Get(context.TODO(), ownerA.GetName(), metav1.GetOptions{})
264264
return err
265-
}).ShouldNot(HaveOccurred())
265+
}).Should(Equal(k8serrors.IsNotFound(err)))
266266

267267
// delete ownerB in the foreground (to ensure any "blocking" dependents are deleted before ownerB)
268268
err = operatorClient.OperatorsV1alpha1().ClusterServiceVersions(testNamespace).Delete(context.TODO(), fetchedB.GetName(), options)
@@ -272,11 +272,11 @@ var _ = Describe("Dependant garbage collection", func() {
272272
Eventually(func() error {
273273
_, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(testNamespace).Get(context.TODO(), ownerB.GetName(), metav1.GetOptions{})
274274
return err
275-
}).ShouldNot(HaveOccurred())
275+
}).Should(Equal(k8serrors.IsNotFound(err)))
276276
})
277277

278278
It("should have deleted the dependent since both the owners were deleted", func() {
279-
_, err := kubeClient.KubernetesInterface().CoreV1().ConfigMaps(testNamespace).Get(context.TODO(), dependent.GetName(), metav1.GetOptions{})
279+
cm, err := kubeClient.KubernetesInterface().CoreV1().ConfigMaps(testNamespace).Get(context.TODO(), dependent.GetName(), metav1.GetOptions{})
280280
Expect(err).To(HaveOccurred())
281281
Expect(k8serrors.IsNotFound(err)).To(BeTrue())
282282
ctx.Ctx().Logf("dependent successfully garbage collected after both owners were deleted")

0 commit comments

Comments
 (0)