Skip to content

Commit

Permalink
test(e2e): fix subscription update flake by retrying
Browse files Browse the repository at this point in the history
  • Loading branch information
njhale committed Jan 10, 2020
1 parent 3772cae commit 4cef16c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/e2e/installplan_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/util/retry"
"k8s.io/kubernetes/pkg/apis/rbac"

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

// Update the subscription resource to point to the beta CSV
subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
require.NoError(t, err)
require.NotNil(t, subscription)
err = retry.RetryOnConflict(retry.DefaultBackoff, func() error {
subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
require.NoError(t, err)
require.NotNil(t, subscription)

subscription.Spec.Channel = betaChannel
subscription, err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).Update(subscription)
require.NoError(t, err)
subscription.Spec.Channel = betaChannel
subscription, err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).Update(subscription)

return err
})

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

0 comments on commit 4cef16c

Please sign in to comment.