Skip to content

Commit

Permalink
Fix ip e2e test case
Browse files Browse the repository at this point in the history
Signed-off-by: perdasilva <perdasilva@redhat.com>
  • Loading branch information
perdasilva committed Mar 29, 2022
1 parent 88f76a7 commit 246c118
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions test/e2e/installplan_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ var _ = Describe("Install Plan", func() {

When("an InstallPlan step contains a deprecated resource version", func() {
var (
csv operatorsv1alpha1.ClusterServiceVersion
plan operatorsv1alpha1.InstallPlan
pdb policyv1beta1.PodDisruptionBudget
manifest string
counter float64
Expand Down Expand Up @@ -102,12 +104,12 @@ var _ = Describe("Install Plan", func() {
}
}

csv := newCSV("test-csv", ns.GetName(), "", semver.Version{}, nil, nil, nil)
csv = newCSV(genName("test-csv-"), ns.GetName(), "", semver.Version{}, nil, nil, nil)
Expect(ctx.Ctx().Client().Create(context.Background(), &csv)).To(Succeed())

pdb = policyv1beta1.PodDisruptionBudget{
ObjectMeta: metav1.ObjectMeta{
Name: "test-pdb",
Name: genName("test-pdb-"),
},
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
Expand All @@ -124,10 +126,10 @@ var _ = Describe("Install Plan", func() {
manifest = b.String()
}

plan := operatorsv1alpha1.InstallPlan{
plan = operatorsv1alpha1.InstallPlan{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns.GetName(),
Name: "test-plan",
Name: genName("test-plan-"),
},
Spec: operatorsv1alpha1.InstallPlanSpec{
Approval: operatorsv1alpha1.ApprovalAutomatic,
Expand All @@ -141,7 +143,7 @@ var _ = Describe("Install Plan", func() {
CatalogSources: []string{},
Plan: []*operatorsv1alpha1.Step{
{
Resolving: "test-csv",
Resolving: csv.GetName(),
Status: operatorsv1alpha1.StepStatusUnknown,
Resource: operatorsv1alpha1.StepResource{
Name: pdb.GetName(),
Expand All @@ -158,6 +160,12 @@ var _ = Describe("Install Plan", func() {
}).Should(HavePhase(operatorsv1alpha1.InstallPlanPhaseComplete))
})

AfterEach(func() {
Eventually(func() error {
return client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), &csv))
}).Should(Succeed())
})

It("creates an Event surfacing the deprecation warning", func() {
Eventually(func() ([]corev1.Event, error) {
var events corev1.EventList
Expand All @@ -184,11 +192,11 @@ var _ = Describe("Install Plan", func() {
APIVersion: operatorsv1alpha1.InstallPlanAPIVersion,
Kind: operatorsv1alpha1.InstallPlanKind,
Namespace: ns.GetName(),
Name: "test-plan",
Name: plan.GetName(),
FieldPath: "status.plan[0]",
},
Reason: "AppliedWithWarnings",
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",
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()),
}))

})
Expand Down

0 comments on commit 246c118

Please sign in to comment.