Skip to content

Commit 26943c9

Browse files
committed
fix(e2e): e2e test for pre-existing crd owner tested incorrect behavior
the test was previously asserting that we would resolve a subscription for an existing csv, which is wrong. if the csv exists in the cluster, we leave it alone (but still consider it's depended/provided apis when resolviing).
1 parent d873bdd commit 26943c9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

test/e2e/installplan_e2e_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func newNginxInstallStrategy(name string, permissions []install.StrategyDeployme
8585
Selector: &metav1.LabelSelector{
8686
MatchLabels: map[string]string{"app": "nginx"},
8787
},
88-
Replicas: &doubleInstance,
88+
Replicas: &singleInstance,
8989
Template: corev1.PodTemplateSpec{
9090
ObjectMeta: metav1.ObjectMeta{
9191
Labels: map[string]string{"app": "nginx"},
@@ -392,11 +392,8 @@ func TestCreateInstallPlanWithPreExistingCRDOwners(t *testing.T) {
392392
require.NoError(t, err)
393393

394394
expectedSteps := map[registry.ResourceKey]struct{}{
395-
registry.ResourceKey{Name: mainCRD.Name, Kind: "CustomResourceDefinition"}: {},
396-
registry.ResourceKey{Name: dependentCRD.Name, Kind: "CustomResourceDefinition"}: {},
397-
registry.ResourceKey{Name: dependentPackageStable, Kind: v1alpha1.ClusterServiceVersionKind}: {},
398-
registry.ResourceKey{Name: mainPackageStable, Kind: v1alpha1.ClusterServiceVersionKind}: {},
399-
registry.ResourceKey{Name: strings.Join([]string{dependentPackageStable, mainCatalogSourceName, testNamespace}, "-"), Kind: v1alpha1.SubscriptionKind}: {},
395+
registry.ResourceKey{Name: mainCRD.Name, Kind: "CustomResourceDefinition"}: {},
396+
registry.ResourceKey{Name: mainPackageStable, Kind: v1alpha1.ClusterServiceVersionKind}: {},
400397
}
401398

402399
// Create the preexisting CRD and CSV
@@ -432,11 +429,12 @@ func TestCreateInstallPlanWithPreExistingCRDOwners(t *testing.T) {
432429
})
433430
require.NoError(t, err)
434431

435-
require.Equal(t, len(fetchedInstallPlan.Status.Plan), len(expectedSteps))
432+
for _, step := range fetchedInstallPlan.Status.Plan {
433+
t.Logf("%#v", step)
434+
}
435+
require.Equal(t, len(fetchedInstallPlan.Status.Plan), len(expectedSteps), "number of expected steps does not match installed")
436436
t.Logf("Number of resolved steps matches the number of expected steps")
437437

438-
require.Equal(t, len(expectedSteps), len(fetchedInstallPlan.Status.Plan), "number of expected steps does not match installed")
439-
440438
for _, step := range fetchedInstallPlan.Status.Plan {
441439
key := registry.ResourceKey{
442440
Name: step.Resource.Name,

0 commit comments

Comments
 (0)