Skip to content

Commit 267aa10

Browse files
committed
Modify the manual instalplan test case to verify the recreation
Signed-off-by: Vu Dinh <[email protected]>
1 parent 554d40b commit 267aa10

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

test/e2e/subscription_e2e_test.go

+19-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,25 @@ var _ = Describe("Subscription", func() {
217217
require.Equal(GinkgoT(), v1alpha1.ApprovalManual, installPlan.Spec.Approval)
218218
require.Equal(GinkgoT(), v1alpha1.InstallPlanPhaseRequiresApproval, installPlan.Status.Phase)
219219

220-
installPlan.Spec.Approved = true
221-
_, err = crc.OperatorsV1alpha1().InstallPlans(testNamespace).Update(context.Background(), installPlan, metav1.UpdateOptions{})
220+
// Delete the current installplan
221+
err = crc.OperatorsV1alpha1().InstallPlans(testNamespace).Delete(context.Background(), installPlan.Name, metav1.DeleteOptions{})
222+
require.NoError(GinkgoT(), err)
223+
224+
subscription, err = fetchSubscription(crc, testNamespace, "manual-subscription", subscriptionStateUpgradePendingChecker)
225+
require.NoError(GinkgoT(), err)
226+
require.NotNil(GinkgoT(), subscription)
227+
228+
// Fetch new installplan
229+
newInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, subscription.Status.Install.Name, buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseRequiresApproval))
230+
require.NoError(GinkgoT(), err)
231+
require.NotNil(GinkgoT(), newInstallPlan)
232+
233+
require.NotEqual(GinkgoT(), installPlan.Name, newInstallPlan.Name, "expected new installplan recreated")
234+
require.Equal(GinkgoT(), v1alpha1.ApprovalManual, newInstallPlan.Spec.Approval)
235+
require.Equal(GinkgoT(), v1alpha1.InstallPlanPhaseRequiresApproval, newInstallPlan.Status.Phase)
236+
237+
newInstallPlan.Spec.Approved = true
238+
_, err = crc.OperatorsV1alpha1().InstallPlans(testNamespace).Update(context.Background(), newInstallPlan, metav1.UpdateOptions{})
222239
require.NoError(GinkgoT(), err)
223240

224241
subscription, err = fetchSubscription(crc, testNamespace, "manual-subscription", subscriptionStateAtLatestChecker)

0 commit comments

Comments
 (0)