Skip to content

Commit

Permalink
chore(e2e): fix a panic in publication and subscription test
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Nenciarini <[email protected]>
  • Loading branch information
mnencia committed Dec 19, 2024
1 parent 2cce974 commit d302d75
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/e2e/publication_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ var _ = Describe("Publication and Subscription", Label(tests.LabelPublicationSub
assertCreateSubscription(namespace, destinationClusterName, subManifest)

var (
publication *apiv1.Publication
subscription *apiv1.Subscription
publication apiv1.Publication
subscription apiv1.Subscription
)
By("setting the reclaimPolicy", func() {
publicationReclaimPolicy := apiv1.PublicationReclaimDelete
Expand All @@ -263,26 +263,24 @@ var _ = Describe("Publication and Subscription", Label(tests.LabelPublicationSub
Expect(err).NotTo(HaveOccurred())

Eventually(func(g Gomega) {
var pub apiv1.Publication
err = testsUtils.GetObject(
env,
types.NamespacedName{Namespace: namespace, Name: pubObjectName},
&pub,
&publication,
)
g.Expect(err).ToNot(HaveOccurred())
publication.Spec.ReclaimPolicy = publicationReclaimPolicy
err = env.Client.Update(env.Ctx, publication)
err = env.Client.Update(env.Ctx, &publication)
g.Expect(err).ToNot(HaveOccurred())

var sub apiv1.Subscription
err = testsUtils.GetObject(
env,
types.NamespacedName{Namespace: namespace, Name: subObjectName},
&sub,
&subscription,
)
g.Expect(err).ToNot(HaveOccurred())
subscription.Spec.ReclaimPolicy = subscriptionReclaimPolicy
err = env.Client.Update(env.Ctx, subscription)
err = env.Client.Update(env.Ctx, &subscription)
g.Expect(err).ToNot(HaveOccurred())
}, 60, 5).Should(Succeed())
})
Expand All @@ -298,8 +296,8 @@ var _ = Describe("Publication and Subscription", Label(tests.LabelPublicationSub
})

By("removing the objects", func() {
Expect(testsUtils.DeleteObject(env, publication)).To(Succeed())
Expect(testsUtils.DeleteObject(env, subscription)).To(Succeed())
Expect(testsUtils.DeleteObject(env, &publication)).To(Succeed())
Expect(testsUtils.DeleteObject(env, &subscription)).To(Succeed())
})

By("verifying the publication reclaim policy outcome", func() {
Expand Down

0 comments on commit d302d75

Please sign in to comment.