@@ -3004,33 +3004,26 @@ var _ = Describe("Install Plan", func() {
3004
3004
var (
3005
3005
ns * corev1.Namespace
3006
3006
catsrcName string
3007
- crc versioned.Interface
3008
3007
ip * operatorsv1alpha1.InstallPlan
3009
3008
)
3010
3009
BeforeEach (func () {
3011
- crc = newCRClient ()
3012
3010
ns = & corev1.Namespace {}
3013
3011
ns .SetName (genName ("ns-" ))
3014
3012
Expect (ctx .Ctx ().Client ().Create (context .Background (), ns )).To (Succeed ())
3015
3013
3016
- // Create the single (kiali) bundle catalog source
3014
+ // Create a dummy CatalogSource to bypass the bundle unpacker's check for a CatalogSource
3017
3015
catsrc := & operatorsv1alpha1.CatalogSource {
3018
3016
ObjectMeta : metav1.ObjectMeta {
3019
- Name : genName ("kiali -" ),
3017
+ Name : genName ("dummy-catsrc -" ),
3020
3018
Namespace : ns .GetName (),
3021
- Labels : map [string ]string {"olm.catalogSource" : "kaili-catalog" },
3022
3019
},
3023
3020
Spec : operatorsv1alpha1.CatalogSourceSpec {
3024
- Image : "quay.io/olmtest/single-bundle-index:1.0.0 " ,
3021
+ Image : "localhost:0/not/exist:catsrc " ,
3025
3022
SourceType : operatorsv1alpha1 .SourceTypeGrpc ,
3026
3023
},
3027
3024
}
3028
3025
Expect (ctx .Ctx ().Client ().Create (context .Background (), catsrc )).To (Succeed ())
3029
3026
3030
- // Wait for the CatalogSource to be ready
3031
- catsrc , err := fetchCatalogSourceOnStatus (crc , catsrc .GetName (), catsrc .GetNamespace (), catalogSourceRegistryPodSynced )
3032
- Expect (err ).ToNot (HaveOccurred ())
3033
-
3034
3027
catsrcName = catsrc .GetName ()
3035
3028
3036
3029
// Create the OperatorGroup
@@ -3045,6 +3038,16 @@ var _ = Describe("Install Plan", func() {
3045
3038
}
3046
3039
Expect (ctx .Ctx ().Client ().Create (context .Background (), og )).To (Succeed ())
3047
3040
3041
+ // Wait for the OperatorGroup to be synced so the InstallPlan doesn't fail due to an invalid OperatorGroup
3042
+ Eventually (
3043
+ func () ([]string , error ) {
3044
+ err := ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (og ), og )
3045
+ ctx .Ctx ().Logf ("Waiting for OperatorGroup(%v) to be synced with status.namespaces: %v" , og .Name , og .Status .Namespaces )
3046
+ return og .Status .Namespaces , err
3047
+ },
3048
+ 1 * time .Minute ,
3049
+ ).Should (ContainElement (ns .GetName ()))
3050
+
3048
3051
now := metav1 .Now ()
3049
3052
ip = & operatorsv1alpha1.InstallPlan {
3050
3053
ObjectMeta : metav1.ObjectMeta {
@@ -3087,7 +3090,7 @@ var _ = Describe("Install Plan", func() {
3087
3090
3088
3091
It ("should show an error on the bundlelookup condition for a non-existent bundle image" , func () {
3089
3092
// Create an InstallPlan status.bundleLookups.Path specified for a non-existent bundle image
3090
- ip .Status .BundleLookups [0 ].Path = "quay.io/foo/bar :v0.0.1"
3093
+ ip .Status .BundleLookups [0 ].Path = "localhost:0/not/exist :v0.0.1"
3091
3094
3092
3095
// We wait for some time over the bundle unpack timeout (i.e ActiveDeadlineSeconds) so that the Job can eventually fail
3093
3096
// Since the default --bundle-unpack-timeout=10m, we override with a shorter timeout via the
@@ -3097,25 +3100,22 @@ var _ = Describe("Install Plan", func() {
3097
3100
ip .SetAnnotations (annotations )
3098
3101
waitFor := 1 * time .Minute + 30 * time .Second
3099
3102
3100
- outIP := ip .DeepCopy ()
3101
-
3102
- Expect (ctx .Ctx ().Client ().Create (context .Background (), outIP )).To (Succeed ())
3103
+ Expect (ctx .Ctx ().Client ().Create (context .Background (), ip )).To (Succeed ())
3103
3104
3104
3105
// The status gets ignored on create so we need to update it else the InstallPlan sync ignores
3105
3106
// InstallPlans without any steps or bundle lookups
3106
- outIP .Status = ip .Status
3107
- Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), outIP )).To (Succeed ())
3107
+ Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), ip )).To (Succeed ())
3108
3108
3109
3109
// The InstallPlan's status.bundleLookup.conditions should have a BundleLookupPending condition
3110
3110
// with the container status from unpack pod that mentions an image pull failure for the non-existent
3111
3111
// image, e.g ErrImagePull or ImagePullBackOff
3112
3112
Eventually (
3113
3113
func () (string , error ) {
3114
- err := ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (outIP ), outIP )
3114
+ err := ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (ip ), ip )
3115
3115
if err != nil {
3116
3116
return "" , err
3117
3117
}
3118
- for _ , bl := range outIP .Status .BundleLookups {
3118
+ for _ , bl := range ip .Status .BundleLookups {
3119
3119
for _ , cond := range bl .Conditions {
3120
3120
if cond .Type != operatorsv1alpha1 .BundleLookupPending {
3121
3121
continue
@@ -3131,8 +3131,8 @@ var _ = Describe("Install Plan", func() {
3131
3131
// The InstallPlan should eventually fail due to the ActiveDeadlineSeconds limit
3132
3132
Eventually (
3133
3133
func () (* operatorsv1alpha1.InstallPlan , error ) {
3134
- err := ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (outIP ), outIP )
3135
- return outIP , err
3134
+ err := ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (ip ), ip )
3135
+ return ip , err
3136
3136
},
3137
3137
waitFor ,
3138
3138
).Should (HavePhase (operatorsv1alpha1 .InstallPlanPhaseFailed ))
@@ -3142,22 +3142,19 @@ var _ = Describe("Install Plan", func() {
3142
3142
// Create an InstallPlan status.bundleLookups.Path specified for an invalid bundle image
3143
3143
ip .Status .BundleLookups [0 ].Path = "alpine:3.13"
3144
3144
3145
- outIP := ip .DeepCopy ()
3146
-
3147
- Expect (ctx .Ctx ().Client ().Create (context .Background (), outIP )).To (Succeed ())
3145
+ Expect (ctx .Ctx ().Client ().Create (context .Background (), ip )).To (Succeed ())
3148
3146
3149
3147
// The status gets ignored on create so we need to update it else the InstallPlan sync ignores
3150
3148
// InstallPlans without any steps or bundle lookups
3151
- outIP .Status = ip .Status
3152
- Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), outIP )).To (Succeed ())
3149
+ Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), ip )).To (Succeed ())
3153
3150
3154
3151
// The InstallPlan should fail after the unpack pod keeps failing and exceeds the job's
3155
3152
// BackoffLimit(set to 3), which with an exponential backoff (10s + 20s + 40s)= 1m10s
3156
3153
// so we wait a little over that.
3157
3154
Eventually (
3158
3155
func () (* operatorsv1alpha1.InstallPlan , error ) {
3159
- err := ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (outIP ), outIP )
3160
- return outIP , err
3156
+ err := ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (ip ), ip )
3157
+ return ip , err
3161
3158
},
3162
3159
2 * time .Minute ,
3163
3160
).Should (HavePhase (operatorsv1alpha1 .InstallPlanPhaseFailed ))
0 commit comments