Skip to content

Commit f5ea867

Browse files
chengfangclaude
andauthored
tests(e2e): add e2e tests to verify status subresource for CRs using legacy annotations (#1536)
Signed-off-by: Cheng Fang <cfang@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2a3d875 commit f5ea867

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/ginkgo/parallel/1-005-annotations-argocd_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
. "github.com/onsi/gomega"
2626
appsv1 "k8s.io/api/apps/v1"
2727
corev1 "k8s.io/api/core/v1"
28+
apimeta "k8s.io/apimachinery/pkg/api/meta"
2829
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2930

3031
applicationFixture "github.com/argoproj-labs/argocd-image-updater/test/ginkgo/fixture/application"
@@ -203,6 +204,35 @@ var _ = Describe("ArgoCD Image Updater Parallel E2E Tests", func() {
203204
// Return an empty string to signify the condition is not yet met.
204205
return ""
205206
}, "5m", "3s").Should(Equal("quay.io/dkarpele/my-guestbook:29437546.0"))
207+
208+
By("verifying ImageUpdater CR status reflects successful reconciliation")
209+
Eventually(func(g Gomega) {
210+
err := k8sClient.Get(ctx, client.ObjectKeyFromObject(imageUpdater), imageUpdater)
211+
g.Expect(err).ToNot(HaveOccurred())
212+
213+
g.Expect(imageUpdater.Status.ApplicationsMatched).To(BeNumerically(">=", int32(1)),
214+
"should match at least 1 application")
215+
g.Expect(imageUpdater.Status.ImagesManaged).To(BeNumerically(">=", int32(1)),
216+
"should manage at least 1 image")
217+
g.Expect(imageUpdater.Status.LastCheckedAt).ToNot(BeNil(),
218+
"lastCheckedAt should be set after reconciliation")
219+
g.Expect(imageUpdater.Status.LastUpdatedAt).ToNot(BeNil(),
220+
"lastUpdatedAt should be set after a successful image update")
221+
g.Expect(imageUpdater.Status.RecentUpdates).ToNot(BeEmpty(),
222+
"recentUpdates should not be empty after a successful image update")
223+
g.Expect(imageUpdater.Status.ObservedGeneration).To(BeNumerically(">", int64(0)),
224+
"observedGeneration should be set")
225+
226+
readyCondition := apimeta.FindStatusCondition(imageUpdater.Status.Conditions, "Ready")
227+
g.Expect(readyCondition).ToNot(BeNil(), "Ready condition should be present")
228+
g.Expect(readyCondition.Status).To(Equal(metav1.ConditionTrue),
229+
"Ready condition should be True")
230+
231+
errorCondition := apimeta.FindStatusCondition(imageUpdater.Status.Conditions, "Error")
232+
g.Expect(errorCondition).ToNot(BeNil(), "Error condition should be present")
233+
g.Expect(errorCondition.Status).To(Equal(metav1.ConditionFalse),
234+
"Error condition should be False for successful reconciliation")
235+
}, "3m", "5s").Should(Succeed())
206236
})
207237
})
208238
})

0 commit comments

Comments
 (0)