Skip to content

Commit 951f4fc

Browse files
authored
Fix ip e2e test case (#2720)
Signed-off-by: perdasilva <[email protected]>
1 parent 88f76a7 commit 951f4fc

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

test/e2e/installplan_e2e_test.go

+15-7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ var _ = Describe("Install Plan", func() {
7272

7373
When("an InstallPlan step contains a deprecated resource version", func() {
7474
var (
75+
csv operatorsv1alpha1.ClusterServiceVersion
76+
plan operatorsv1alpha1.InstallPlan
7577
pdb policyv1beta1.PodDisruptionBudget
7678
manifest string
7779
counter float64
@@ -102,12 +104,12 @@ var _ = Describe("Install Plan", func() {
102104
}
103105
}
104106

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)
106108
Expect(ctx.Ctx().Client().Create(context.Background(), &csv)).To(Succeed())
107109

108110
pdb = policyv1beta1.PodDisruptionBudget{
109111
ObjectMeta: metav1.ObjectMeta{
110-
Name: "test-pdb",
112+
Name: genName("test-pdb-"),
111113
},
112114
TypeMeta: metav1.TypeMeta{
113115
Kind: "PodDisruptionBudget",
@@ -124,10 +126,10 @@ var _ = Describe("Install Plan", func() {
124126
manifest = b.String()
125127
}
126128

127-
plan := operatorsv1alpha1.InstallPlan{
129+
plan = operatorsv1alpha1.InstallPlan{
128130
ObjectMeta: metav1.ObjectMeta{
129131
Namespace: ns.GetName(),
130-
Name: "test-plan",
132+
Name: genName("test-plan-"),
131133
},
132134
Spec: operatorsv1alpha1.InstallPlanSpec{
133135
Approval: operatorsv1alpha1.ApprovalAutomatic,
@@ -141,7 +143,7 @@ var _ = Describe("Install Plan", func() {
141143
CatalogSources: []string{},
142144
Plan: []*operatorsv1alpha1.Step{
143145
{
144-
Resolving: "test-csv",
146+
Resolving: csv.GetName(),
145147
Status: operatorsv1alpha1.StepStatusUnknown,
146148
Resource: operatorsv1alpha1.StepResource{
147149
Name: pdb.GetName(),
@@ -158,6 +160,12 @@ var _ = Describe("Install Plan", func() {
158160
}).Should(HavePhase(operatorsv1alpha1.InstallPlanPhaseComplete))
159161
})
160162

163+
AfterEach(func() {
164+
Eventually(func() error {
165+
return client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), &csv))
166+
}).Should(Succeed())
167+
})
168+
161169
It("creates an Event surfacing the deprecation warning", func() {
162170
Eventually(func() ([]corev1.Event, error) {
163171
var events corev1.EventList
@@ -184,11 +192,11 @@ var _ = Describe("Install Plan", func() {
184192
APIVersion: operatorsv1alpha1.InstallPlanAPIVersion,
185193
Kind: operatorsv1alpha1.InstallPlanKind,
186194
Namespace: ns.GetName(),
187-
Name: "test-plan",
195+
Name: plan.GetName(),
188196
FieldPath: "status.plan[0]",
189197
},
190198
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()),
192200
}))
193201

194202
})

0 commit comments

Comments
 (0)