@@ -3009,7 +3009,9 @@ var _ = Describe("Install Plan", func() {
3009
3009
BeforeEach (func () {
3010
3010
ns = & corev1.Namespace {}
3011
3011
ns .SetName (genName ("ns-" ))
3012
- Expect (ctx .Ctx ().Client ().Create (context .Background (), ns )).To (Succeed ())
3012
+ Eventually (func () error {
3013
+ return ctx .Ctx ().Client ().Create (context .Background (), ns )
3014
+ }, timeout , interval ).Should (Succeed (), "could not create Namespace" )
3013
3015
3014
3016
// Create a dummy CatalogSource to bypass the bundle unpacker's check for a CatalogSource
3015
3017
catsrc := & operatorsv1alpha1.CatalogSource {
@@ -3022,7 +3024,9 @@ var _ = Describe("Install Plan", func() {
3022
3024
SourceType : operatorsv1alpha1 .SourceTypeGrpc ,
3023
3025
},
3024
3026
}
3025
- Expect (ctx .Ctx ().Client ().Create (context .Background (), catsrc )).To (Succeed ())
3027
+ Eventually (func () error {
3028
+ return ctx .Ctx ().Client ().Create (context .Background (), catsrc )
3029
+ }, timeout , interval ).Should (Succeed (), "could not create CatalogSource" )
3026
3030
3027
3031
catsrcName = catsrc .GetName ()
3028
3032
@@ -3036,7 +3040,9 @@ var _ = Describe("Install Plan", func() {
3036
3040
TargetNamespaces : []string {ns .GetName ()},
3037
3041
},
3038
3042
}
3039
- Expect (ctx .Ctx ().Client ().Create (context .Background (), og )).To (Succeed ())
3043
+ Eventually (func () error {
3044
+ return ctx .Ctx ().Client ().Create (context .Background (), og )
3045
+ }, timeout , interval ).Should (Succeed (), "could not create OperatorGroup" )
3040
3046
3041
3047
// Wait for the OperatorGroup to be synced so the InstallPlan doesn't fail due to an invalid OperatorGroup
3042
3048
Eventually (
@@ -3046,6 +3052,7 @@ var _ = Describe("Install Plan", func() {
3046
3052
return og .Status .Namespaces , err
3047
3053
},
3048
3054
1 * time .Minute ,
3055
+ interval ,
3049
3056
).Should (ContainElement (ns .GetName ()))
3050
3057
3051
3058
now := metav1 .Now ()
@@ -3085,7 +3092,9 @@ var _ = Describe("Install Plan", func() {
3085
3092
})
3086
3093
3087
3094
AfterEach (func () {
3088
- Expect (ctx .Ctx ().Client ().Delete (context .Background (), ns )).To (Succeed ())
3095
+ Eventually (func () error {
3096
+ return ctx .Ctx ().Client ().Delete (context .Background (), ns )
3097
+ }, timeout , interval ).Should (Succeed (), "could not delete Namespace" )
3089
3098
})
3090
3099
3091
3100
It ("should show an error on the bundlelookup condition for a non-existent bundle image" , func () {
@@ -3100,11 +3109,15 @@ var _ = Describe("Install Plan", func() {
3100
3109
ip .SetAnnotations (annotations )
3101
3110
waitFor := 1 * time .Minute + 30 * time .Second
3102
3111
3103
- Expect (ctx .Ctx ().Client ().Create (context .Background (), ip )).To (Succeed ())
3112
+ Eventually (func () error {
3113
+ return ctx .Ctx ().Client ().Create (context .Background (), ip )
3114
+ }, timeout , interval ).Should (Succeed (), "could not create InstallPlan" )
3104
3115
3105
3116
// The status gets ignored on create so we need to update it else the InstallPlan sync ignores
3106
3117
// InstallPlans without any steps or bundle lookups
3107
- Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), ip )).To (Succeed ())
3118
+ Eventually (func () error {
3119
+ return ctx .Ctx ().Client ().Status ().Update (context .Background (), ip )
3120
+ }, timeout , interval ).Should (Succeed (), "could not update InstallPlan status" )
3108
3121
3109
3122
// The InstallPlan's status.bundleLookup.conditions should have a BundleLookupPending condition
3110
3123
// with the container status from unpack pod that mentions an image pull failure for the non-existent
@@ -3126,6 +3139,7 @@ var _ = Describe("Install Plan", func() {
3126
3139
return "" , fmt .Errorf ("%s condition not found" , operatorsv1alpha1 .BundleLookupPending )
3127
3140
},
3128
3141
1 * time .Minute ,
3142
+ interval ,
3129
3143
).Should (ContainSubstring ("ErrImagePull" ))
3130
3144
3131
3145
// The InstallPlan should eventually fail due to the ActiveDeadlineSeconds limit
@@ -3135,18 +3149,23 @@ var _ = Describe("Install Plan", func() {
3135
3149
return ip , err
3136
3150
},
3137
3151
waitFor ,
3152
+ interval ,
3138
3153
).Should (HavePhase (operatorsv1alpha1 .InstallPlanPhaseFailed ))
3139
3154
})
3140
3155
3141
3156
It ("should timeout and fail the InstallPlan for an invalid bundle image" , func () {
3142
3157
// Create an InstallPlan status.bundleLookups.Path specified for an invalid bundle image
3143
3158
ip .Status .BundleLookups [0 ].Path = "alpine:3.13"
3144
3159
3145
- Expect (ctx .Ctx ().Client ().Create (context .Background (), ip )).To (Succeed ())
3160
+ Eventually (func () error {
3161
+ return ctx .Ctx ().Client ().Create (context .Background (), ip )
3162
+ }, timeout , interval ).Should (Succeed (), "could not create InstallPlan" )
3146
3163
3147
3164
// The status gets ignored on create so we need to update it else the InstallPlan sync ignores
3148
3165
// InstallPlans without any steps or bundle lookups
3149
- Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), ip )).To (Succeed ())
3166
+ Eventually (func () error {
3167
+ return ctx .Ctx ().Client ().Status ().Update (context .Background (), ip )
3168
+ }, timeout , interval ).Should (Succeed (), "could not update InstallPlan status" )
3150
3169
3151
3170
// The InstallPlan should fail after the unpack pod keeps failing and exceeds the job's
3152
3171
// BackoffLimit(set to 3), which for 4 failures is an exponential backoff (10s + 20s + 40s + 80s)= 2m30s
@@ -3157,6 +3176,7 @@ var _ = Describe("Install Plan", func() {
3157
3176
return ip , err
3158
3177
},
3159
3178
5 * time .Minute ,
3179
+ interval ,
3160
3180
).Should (HavePhase (operatorsv1alpha1 .InstallPlanPhaseFailed ))
3161
3181
})
3162
3182
0 commit comments