Skip to content

Commit

Permalink
Check for OutdatedReason event in lifecycle test
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <[email protected]>
  • Loading branch information
stefanprodan committed Oct 4, 2024
1 parent eeed6ef commit 382b013
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions internal/controller/fluxinstance_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 382b013

Please sign in to comment.