@@ -72,6 +72,8 @@ var _ = Describe("Install Plan", func() {
72
72
73
73
When ("an InstallPlan step contains a deprecated resource version" , func () {
74
74
var (
75
+ csv operatorsv1alpha1.ClusterServiceVersion
76
+ plan operatorsv1alpha1.InstallPlan
75
77
pdb policyv1beta1.PodDisruptionBudget
76
78
manifest string
77
79
counter float64
@@ -102,12 +104,12 @@ var _ = Describe("Install Plan", func() {
102
104
}
103
105
}
104
106
105
- csv : = newCSV ("test-csv" , ns .GetName (), "" , semver.Version {}, nil , nil , nil )
107
+ csv = newCSV (genName ( "test-csv-" ) , ns .GetName (), "" , semver.Version {}, nil , nil , nil )
106
108
Expect (ctx .Ctx ().Client ().Create (context .Background (), & csv )).To (Succeed ())
107
109
108
110
pdb = policyv1beta1.PodDisruptionBudget {
109
111
ObjectMeta : metav1.ObjectMeta {
110
- Name : "test-pdb" ,
112
+ Name : genName ( "test-pdb-" ) ,
111
113
},
112
114
TypeMeta : metav1.TypeMeta {
113
115
Kind : "PodDisruptionBudget" ,
@@ -124,10 +126,10 @@ var _ = Describe("Install Plan", func() {
124
126
manifest = b .String ()
125
127
}
126
128
127
- plan : = operatorsv1alpha1.InstallPlan {
129
+ plan = operatorsv1alpha1.InstallPlan {
128
130
ObjectMeta : metav1.ObjectMeta {
129
131
Namespace : ns .GetName (),
130
- Name : "test-plan" ,
132
+ Name : genName ( "test-plan-" ) ,
131
133
},
132
134
Spec : operatorsv1alpha1.InstallPlanSpec {
133
135
Approval : operatorsv1alpha1 .ApprovalAutomatic ,
@@ -141,7 +143,7 @@ var _ = Describe("Install Plan", func() {
141
143
CatalogSources : []string {},
142
144
Plan : []* operatorsv1alpha1.Step {
143
145
{
144
- Resolving : "test- csv" ,
146
+ Resolving : csv . GetName () ,
145
147
Status : operatorsv1alpha1 .StepStatusUnknown ,
146
148
Resource : operatorsv1alpha1.StepResource {
147
149
Name : pdb .GetName (),
@@ -158,6 +160,12 @@ var _ = Describe("Install Plan", func() {
158
160
}).Should (HavePhase (operatorsv1alpha1 .InstallPlanPhaseComplete ))
159
161
})
160
162
163
+ AfterEach (func () {
164
+ Eventually (func () error {
165
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & csv ))
166
+ }).Should (Succeed ())
167
+ })
168
+
161
169
It ("creates an Event surfacing the deprecation warning" , func () {
162
170
Eventually (func () ([]corev1.Event , error ) {
163
171
var events corev1.EventList
@@ -184,11 +192,11 @@ var _ = Describe("Install Plan", func() {
184
192
APIVersion : operatorsv1alpha1 .InstallPlanAPIVersion ,
185
193
Kind : operatorsv1alpha1 .InstallPlanKind ,
186
194
Namespace : ns .GetName (),
187
- Name : "test- plan" ,
195
+ Name : plan . GetName () ,
188
196
FieldPath : "status.plan[0]" ,
189
197
},
190
198
Reason : "AppliedWithWarnings" ,
191
- Message : "1 warning(s) generated during installation of operator \" test-csv \" (PodDisruptionBudget \" test-pdb \" ): policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget" ,
199
+ Message : fmt . Sprintf ( "1 warning(s) generated during installation of operator \" %s \" (PodDisruptionBudget \" %s \" ): policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget" , csv . GetName (), pdb . GetName ()) ,
192
200
}))
193
201
194
202
})
0 commit comments