Skip to content

Commit be048a8

Browse files
committed
test(subscription): add additional testing around installplan generation
during manual approval subscriptions
1 parent b853cc5 commit be048a8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/e2e/subscription_e2e_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,11 @@ func TestSusbcriptionWithStartingCSV(t *testing.T) {
569569
fetchedInstallPlan, err := fetchInstallPlan(t, crc, installPlanName, requiresApprovalChecker)
570570
require.NoError(t, err)
571571

572+
// Ensure that only 1 installplan was created
573+
ips, err := crc.OperatorsV1alpha1().InstallPlans(testNamespace).List(metav1.ListOptions{})
574+
require.NoError(t, err)
575+
require.Len(t, ips.Items, 1)
576+
572577
// Ensure that csvA and its crd are found in the plan
573578
csvFound := false
574579
crdFound := false
@@ -590,6 +595,21 @@ func TestSusbcriptionWithStartingCSV(t *testing.T) {
590595
require.True(t, csvFound, "expected csv not found in installplan")
591596
require.True(t, crdFound, "expected crd not found in installplan")
592597

598+
// Ensure that csvB is not found in the plan
599+
csvFound = false
600+
for _, s := range fetchedInstallPlan.Status.Plan {
601+
require.Equal(t, csvA.GetName(), s.Resolving, "unexpected resolution found")
602+
require.Equal(t, v1alpha1.StepStatusUnknown, s.Status, "status should be unknown")
603+
require.Equal(t, catalogSourceName, s.Resource.CatalogSource, "incorrect catalogsource on step resource")
604+
switch kind := s.Resource.Kind; kind {
605+
case v1alpha1.ClusterServiceVersionKind:
606+
if s.Resource.Name == csvB.GetName() {
607+
csvFound = true
608+
}
609+
}
610+
}
611+
require.False(t, csvFound, "expected csv not found in installplan")
612+
593613
// Approve the installplan and wait for csvA to be installed
594614
fetchedInstallPlan.Spec.Approved = true
595615
_, err = crc.OperatorsV1alpha1().InstallPlans(testNamespace).Update(fetchedInstallPlan)
@@ -613,6 +633,11 @@ func TestSusbcriptionWithStartingCSV(t *testing.T) {
613633

614634
_, err = awaitCSV(t, crc, testNamespace, csvB.GetName(), csvSucceededChecker)
615635
require.NoError(t, err)
636+
637+
// Ensure that 2 installplans were created
638+
ips, err = crc.OperatorsV1alpha1().InstallPlans(testNamespace).List(metav1.ListOptions{})
639+
require.NoError(t, err)
640+
require.Len(t, ips.Items, 2)
616641
}
617642

618643
func TestSubscriptionUpdatesMultipleIntermediates(t *testing.T) {

0 commit comments

Comments
 (0)