Skip to content

Commit 0b5020f

Browse files
committed
e2e: Add catalog source health check to assertSubscription
By OLM design, a subscription cannot be installed unless all catalog sources are healthy, regardless of which catalog source the subscription uses. This commit updates the `assertSubscription` helper to verify catalog source health as part of its checks. The timeout was increased to 2 minutes to accommodate the additional polling time.
1 parent 03c72b7 commit 0b5020f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/e2e/util_gatewayapi_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,22 @@ func assertSubscription(t *testing.T, namespace, subName string) error {
568568
subscription := &operatorsv1alpha1.Subscription{}
569569
nsName := types.NamespacedName{Namespace: namespace, Name: subName}
570570

571-
err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 30*time.Second, false, func(context context.Context) (bool, error) {
571+
err := wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 2*time.Minute, false, func(context context.Context) (bool, error) {
572572
if err := kclient.Get(context, nsName, subscription); err != nil {
573573
t.Logf("failed to get subscription %s, retrying...", subName)
574574
return false, nil
575575
}
576576
t.Logf("found subscription %s at installed version %s", subscription.Name, subscription.Status.InstalledCSV)
577+
for _, c := range subscription.Status.Conditions {
578+
if c.Type == operatorsv1alpha1.SubscriptionCatalogSourcesUnhealthy {
579+
if c.Status == corev1.ConditionTrue {
580+
t.Logf("catalog sources unhealthy for subscription %s, retrying...", subName)
581+
return false, nil
582+
}
583+
break
584+
}
585+
}
586+
t.Logf("all catalog sources healthy for subscription %s", subscription.Name)
577587
return true, nil
578588
})
579589
return err

0 commit comments

Comments
 (0)