From 382b0132abc587e998e756d6a0999be56fcbe87d Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 4 Oct 2024 13:22:16 +0300 Subject: [PATCH] Check for `OutdatedReason` event in lifecycle test Signed-off-by: Stefan Prodan --- .../fluxinstance_controller_test.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/controller/fluxinstance_controller_test.go b/internal/controller/fluxinstance_controller_test.go index 2592e66..3596745 100644 --- a/internal/controller/fluxinstance_controller_test.go +++ b/internal/controller/fluxinstance_controller_test.go @@ -181,15 +181,16 @@ func TestFluxInstanceReconciler_LifeCycle(t *testing.T) { // Check if events were recorded for each step. events := getEvents(result.Name) - g.Expect(events).To(HaveLen(4)) - g.Expect(events[0].Reason).To(Equal(meta.ProgressingReason)) - g.Expect(events[0].Message).To(HavePrefix("Installing")) - g.Expect(events[1].Reason).To(Equal(meta.ReconciliationSucceededReason)) - g.Expect(events[1].Message).To(HavePrefix("Reconciliation finished")) - g.Expect(events[2].Reason).To(Equal(meta.ProgressingReason)) - g.Expect(events[2].Message).To(HavePrefix("Upgrading")) - g.Expect(events[3].Reason).To(Equal(meta.ReconciliationSucceededReason)) - g.Expect(events[3].Annotations).To(HaveKeyWithValue(fluxcdv1.RevisionAnnotation, resultFinal.Status.LastAppliedRevision)) + g.Expect(events).To(HaveLen(5)) + g.Expect(events[0].Reason).To(Equal(fluxcdv1.OutdatedReason)) + g.Expect(events[1].Reason).To(Equal(meta.ProgressingReason)) + g.Expect(events[1].Message).To(HavePrefix("Installing")) + g.Expect(events[2].Reason).To(Equal(meta.ReconciliationSucceededReason)) + g.Expect(events[2].Message).To(HavePrefix("Reconciliation finished")) + g.Expect(events[3].Reason).To(Equal(meta.ProgressingReason)) + g.Expect(events[3].Message).To(HavePrefix("Upgrading")) + g.Expect(events[4].Reason).To(Equal(meta.ReconciliationSucceededReason)) + g.Expect(events[4].Annotations).To(HaveKeyWithValue(fluxcdv1.RevisionAnnotation, resultFinal.Status.LastAppliedRevision)) err = testClient.Delete(ctx, obj) g.Expect(err).ToNot(HaveOccurred())