Skip to content

Commit 6b39352

Browse files
authored
test(e2e): use server-side apply to update fixture (#2385)
Use server-side apply to update a fixture and avoid false negatives due caused by resource contention. Signed-off-by: Nick Hale <[email protected]>
1 parent 584e12a commit 6b39352

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

test/e2e/csv_e2e_test.go

+8-15
Original file line numberDiff line numberDiff line change
@@ -3739,27 +3739,20 @@ var _ = Describe("ClusterServiceVersion", func() {
37393739
Expect(err).ToNot(HaveOccurred())
37403740
defer cleanupCSV()
37413741

3742-
csv, err = fetchCSV(crc, csv.GetName(), csv.GetNamespace(), csvPendingChecker)
3743-
Expect(err).ToNot(HaveOccurred())
3744-
37453742
By("emitting when requirements are not met")
37463743
nextReason := func() string {
3747-
e := <-w.ResultChan()
3748-
if e.Object == nil {
3749-
return ""
3744+
if e := <-w.ResultChan(); e.Object != nil {
3745+
return e.Object.(*corev1.Event).Reason
37503746
}
3751-
3752-
return e.Object.(*corev1.Event).Reason
3747+
return ""
37533748
}
37543749
Eventually(nextReason).Should(Equal("RequirementsNotMet"))
37553750

3756-
// Update the CSV to require an API that we know exists
3757-
csv.Spec.APIServiceDefinitions.Required[0].Group = "packages.operators.coreos.com"
3758-
updateOpts := metav1.UpdateOptions{}
3759-
Eventually(func() error {
3760-
_, err := crc.OperatorsV1alpha1().ClusterServiceVersions(csv.GetNamespace()).Update(clientCtx, csv, updateOpts)
3761-
return err
3762-
}).Should(Succeed())
3751+
// Patch the CSV to require an API that we know exists
3752+
Eventually(ctx.Ctx().SSAClient().Apply(clientCtx, csv, func(c *v1alpha1.ClusterServiceVersion) error {
3753+
c.Spec.APIServiceDefinitions.Required[0].Group = "packages.operators.coreos.com"
3754+
return nil
3755+
})).Should(Succeed())
37633756

37643757
By("emitting when requirements are met")
37653758
Eventually(nextReason).Should(Equal("AllRequirementsMet"))

0 commit comments

Comments
 (0)