Skip to content

Commit 4cef16c

Browse files
committed
test(e2e): fix subscription update flake by retrying
1 parent 3772cae commit 4cef16c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

test/e2e/installplan_e2e_test.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2121
"k8s.io/apimachinery/pkg/util/wait"
2222
"k8s.io/apimachinery/pkg/watch"
23+
"k8s.io/client-go/util/retry"
2324
"k8s.io/kubernetes/pkg/apis/rbac"
2425

2526
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
@@ -1028,13 +1029,16 @@ func TestInstallPlanWithCRDSchemaChange(t *testing.T) {
10281029
require.NoError(t, err)
10291030

10301031
// Update the subscription resource to point to the beta CSV
1031-
subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
1032-
require.NoError(t, err)
1033-
require.NotNil(t, subscription)
1032+
err = retry.RetryOnConflict(retry.DefaultBackoff, func() error {
1033+
subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
1034+
require.NoError(t, err)
1035+
require.NotNil(t, subscription)
10341036

1035-
subscription.Spec.Channel = betaChannel
1036-
subscription, err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).Update(subscription)
1037-
require.NoError(t, err)
1037+
subscription.Spec.Channel = betaChannel
1038+
subscription, err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).Update(subscription)
1039+
1040+
return err
1041+
})
10381042

10391043
// Wait for subscription to have a new installplan
10401044
subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName()))

0 commit comments

Comments
 (0)