Skip to content

Commit b3a6b60

Browse files
tmshortstevekuznetsov
authored andcommitted
fixup! Fix some of the e2e loops
Signed-off-by: Todd Short <[email protected]>
1 parent e5f7320 commit b3a6b60

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

test/e2e/csv_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4444,7 +4444,7 @@ func fetchCSV(c versioned.Interface, namespace, name string, checker csvConditio
44444444
err := wait.Poll(pollInterval, pollDuration, func() (bool, error) {
44454445
var err error
44464446
csv, err = c.OperatorsV1alpha1().ClusterServiceVersions(namespace).Get(context.TODO(), name, metav1.GetOptions{})
4447-
if err != nil {
4447+
if err != nil || csv == nil {
44484448
ctx.Ctx().Logf("error getting csv %s/%s: %v", namespace, name, err)
44494449
return false, nil
44504450
}

test/e2e/subscription_e2e_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3081,7 +3081,6 @@ func subscriptionHasCondition(condType operatorsv1alpha1.SubscriptionConditionTy
30813081

30823082
func fetchSubscription(crc versioned.Interface, namespace, name string, checker subscriptionStateChecker) (*operatorsv1alpha1.Subscription, error) {
30833083
var fetchedSubscription *operatorsv1alpha1.Subscription
3084-
var err error
30853084

30863085
log := func(s string) {
30873086
ctx.Ctx().Logf("%s: %s", time.Now().Format("15:04:05.9999"), s)
@@ -3091,10 +3090,12 @@ func fetchSubscription(crc versioned.Interface, namespace, name string, checker
30913090
var lastCSV string
30923091
var lastInstallPlanRef *corev1.ObjectReference
30933092

3094-
err = wait.Poll(pollInterval, pollDuration, func() (bool, error) {
3093+
err := wait.Poll(pollInterval, pollDuration, func() (bool, error) {
3094+
var err error
30953095
fetchedSubscription, err = crc.OperatorsV1alpha1().Subscriptions(namespace).Get(context.Background(), name, metav1.GetOptions{})
30963096
if err != nil || fetchedSubscription == nil {
3097-
return false, err
3097+
log(fmt.Sprintf("error getting subscription %s/%s: %v", namespace, name, err))
3098+
return false, nil
30983099
}
30993100
thisState, thisCSV, thisInstallPlanRef := fetchedSubscription.Status.State, fetchedSubscription.Status.CurrentCSV, fetchedSubscription.Status.InstallPlanRef
31003101
if thisState != lastState || thisCSV != lastCSV || !equality.Semantic.DeepEqual(thisInstallPlanRef, lastInstallPlanRef) {
@@ -3104,10 +3105,11 @@ func fetchSubscription(crc versioned.Interface, namespace, name string, checker
31043105
return checker(fetchedSubscription), nil
31053106
})
31063107
if err != nil {
3107-
log(fmt.Sprintf("never got correct status: %#v", fetchedSubscription.Status))
3108-
log(fmt.Sprintf("subscription spec: %#v", fetchedSubscription.Spec))
3108+
log(fmt.Sprintf("subscription %s/%s never got correct status: %#v", namespace, name, fetchedSubscription.Status))
3109+
log(fmt.Sprintf("subscription %s/%s spec: %#v", namespace, name, fetchedSubscription.Spec))
3110+
return nil, err
31093111
}
3110-
return fetchedSubscription, err
3112+
return fetchedSubscription, nil
31113113
}
31123114

31133115
func buildSubscriptionCleanupFunc(crc versioned.Interface, subscription *operatorsv1alpha1.Subscription) cleanupFunc {

0 commit comments

Comments
 (0)