Skip to content

Commit d322094

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 7236c98 commit d322094

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
@@ -574,12 +574,22 @@ func assertSubscription(t *testing.T, namespace, subName string) error {
574574
subscription := &operatorsv1alpha1.Subscription{}
575575
nsName := types.NamespacedName{Namespace: namespace, Name: subName}
576576

577-
err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 30*time.Second, false, func(context context.Context) (bool, error) {
577+
err := wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 2*time.Minute, false, func(context context.Context) (bool, error) {
578578
if err := kclient.Get(context, nsName, subscription); err != nil {
579579
t.Logf("failed to get subscription %s, retrying...", subName)
580580
return false, nil
581581
}
582582
t.Logf("found subscription %s at installed version %s", subscription.Name, subscription.Status.InstalledCSV)
583+
for _, c := range subscription.Status.Conditions {
584+
if c.Type == operatorsv1alpha1.SubscriptionCatalogSourcesUnhealthy {
585+
if c.Status == corev1.ConditionTrue {
586+
t.Logf("catalog sources unhealthy for subscription %s, retrying...", subName)
587+
return false, nil
588+
}
589+
break
590+
}
591+
}
592+
t.Logf("all catalog sources healthy for subscription %s", subscription.Name)
583593
return true, nil
584594
})
585595
return err

0 commit comments

Comments
 (0)