Skip to content

Commit 3e0230e

Browse files
perdasilvaPer Goncalves da Silva
and
Per Goncalves da Silva
authored
bugfix: refactor test package names 'packageA' and 'packageB' because they break naming conventions (#3260)
Signed-off-by: Per Goncalves da Silva <[email protected]> Co-authored-by: Per Goncalves da Silva <[email protected]>
1 parent a3069db commit 3e0230e

27 files changed

+297
-294
lines changed

pkg/controller/registry/resolver/resolver_test.go

+199-199
Large diffs are not rendered by default.

test/e2e/catalog_e2e_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
14491449
CatalogSource: catalogSourceName,
14501450
CatalogSourceNamespace: generatedNamespace.GetName(),
14511451
Channel: "stable",
1452-
Package: "packageA",
1452+
Package: "test-package",
14531453
},
14541454
}
14551455
Expect(c.Create(context.Background(), subscription)).To(BeNil())

test/e2e/catalog_exclusion_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
9494
Spec: &v1alpha1.SubscriptionSpec{
9595
CatalogSource: localCatalog.GetName(),
9696
CatalogSourceNamespace: localCatalog.GetNamespace(),
97-
Package: "packageA",
97+
Package: "test-package",
9898
Channel: "stable",
9999
InstallPlanApproval: v1alpha1.ApprovalAutomatic,
100100
},

test/e2e/data/catalog.new.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contains PackageB (Updated), PackageC (new)
1+
# Contains another-package (Updated), PackageC (new)
22
kind: ConfigMap
33
apiVersion: v1
44
metadata:

test/e2e/data/catalog.old.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contains PackageA, PackageB
1+
# Contains test-package, another-package
22
kind: ConfigMap
33
apiVersion: v1
44
metadata:

test/e2e/fail_forward_e2e_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
183183
CatalogSource: catalogSourceName,
184184
CatalogSourceNamespace: generatedNamespace.GetName(),
185185
Channel: "stable",
186-
Package: "packageA",
186+
Package: "test-package",
187187
},
188188
}
189189
Expect(c.Create(context.Background(), subscription)).To(BeNil())
@@ -348,7 +348,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
348348
CatalogSource: catalogSourceName,
349349
CatalogSourceNamespace: generatedNamespace.GetName(),
350350
Channel: "stable",
351-
Package: "packageA",
351+
Package: "test-package",
352352
},
353353
}
354354
Expect(c.Create(context.Background(), subscription)).To(BeNil())

test/e2e/magic_catalog_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,19 @@ var _ = Describe("MagicCatalog", func() {
9090
return data
9191
}, ContainSubstring(`---
9292
schema: olm.package
93-
name: packageA
93+
name: test-package
9494
defaultChannel: stable
9595
---
9696
schema: olm.channel
97-
package: packageA
97+
package: test-package
9898
name: stable
9999
entries:
100100
- name: busybox.v2.0.0
101101
replaces: busybox.v1.0.0
102102
---
103103
schema: olm.bundle
104104
name: busybox.v2.0.0
105-
package: packageA
105+
package: test-package
106106
image: quay.io/olmtest/busybox-bundle:2.0.0
107107
properties:
108108
- type: olm.gvk
@@ -112,7 +112,7 @@ properties:
112112
version: v1alpha1
113113
- type: olm.package
114114
value:
115-
packageName: packageA
115+
packageName: test-package
116116
version: 1.0.0
117117
`)),
118118
))

test/e2e/subscription_e2e_test.go

+29-26
Original file line numberDiff line numberDiff line change
@@ -1461,53 +1461,57 @@ var _ = Describe("Subscription", func() {
14611461
By(`csvs for catalogsource 2`)
14621462
csvs2 := make([]operatorsv1alpha1.ClusterServiceVersion, 0)
14631463

1464-
packageA := registry.PackageManifest{PackageName: "PackageA"}
1464+
testPackage := registry.PackageManifest{PackageName: "test-package"}
14651465
By("Package A", func() {
14661466
Step(1, "Default Channel: Stable", func() {
1467-
packageA.DefaultChannelName = stableChannel
1467+
testPackage.DefaultChannelName = stableChannel
14681468
})
14691469

14701470
Step(1, "Channel Stable", func() {
14711471
Step(2, "Operator A (Requires CRD, CRD 2)", func() {
14721472
csvA := newCSV("csv-a", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), nil, []apiextensionsv1.CustomResourceDefinition{crd, crd2}, nil)
1473-
packageA.Channels = append(packageA.Channels, registry.PackageChannel{Name: stableChannel, CurrentCSVName: csvA.GetName()})
1473+
testPackage.
1474+
Channels = append(testPackage.
1475+
Channels, registry.PackageChannel{Name: stableChannel, CurrentCSVName: csvA.GetName()})
14741476
csvs1 = append(csvs1, csvA)
14751477
})
14761478
})
14771479

14781480
Step(1, "Channel Alpha", func() {
14791481
Step(2, "Operator ABC (Provides: CRD, CRD 2)", func() {
14801482
csvABC := newCSV("csv-abc", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crd, crd2}, nil, nil)
1481-
packageA.Channels = append(packageA.Channels, registry.PackageChannel{Name: alphaChannel, CurrentCSVName: csvABC.GetName()})
1483+
testPackage.
1484+
Channels = append(testPackage.
1485+
Channels, registry.PackageChannel{Name: alphaChannel, CurrentCSVName: csvABC.GetName()})
14821486
csvs1 = append(csvs1, csvABC)
14831487
})
14841488
})
14851489
})
14861490

1487-
packageB := registry.PackageManifest{PackageName: "PackageB"}
1491+
anotherPackage := registry.PackageManifest{PackageName: "another-package"}
14881492
By("Package B", func() {
14891493
Step(1, "Default Channel: Stable", func() {
1490-
packageB.DefaultChannelName = stableChannel
1494+
anotherPackage.DefaultChannelName = stableChannel
14911495
})
14921496

14931497
Step(1, "Channel Stable", func() {
14941498
Step(2, "Operator B (Provides: CRD)", func() {
14951499
csvB := newCSV("csv-b", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil)
1496-
packageB.Channels = append(packageB.Channels, registry.PackageChannel{Name: stableChannel, CurrentCSVName: csvB.GetName()})
1500+
anotherPackage.Channels = append(anotherPackage.Channels, registry.PackageChannel{Name: stableChannel, CurrentCSVName: csvB.GetName()})
14971501
csvs1 = append(csvs1, csvB)
14981502
})
14991503
})
15001504

15011505
Step(1, "Channel Alpha", func() {
15021506
Step(2, "Operator D (Provides: CRD)", func() {
15031507
csvD := newCSV("csv-d", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil)
1504-
packageB.Channels = append(packageB.Channels, registry.PackageChannel{Name: alphaChannel, CurrentCSVName: csvD.GetName()})
1508+
anotherPackage.Channels = append(anotherPackage.Channels, registry.PackageChannel{Name: alphaChannel, CurrentCSVName: csvD.GetName()})
15051509
csvs1 = append(csvs1, csvD)
15061510
})
15071511
})
15081512
})
15091513

1510-
packageBInCatsrc2 := registry.PackageManifest{PackageName: "PackageB"}
1514+
packageBInCatsrc2 := registry.PackageManifest{PackageName: "another-package"}
15111515
By("Package B", func() {
15121516
Step(1, "Default Channel: Stable", func() {
15131517
packageBInCatsrc2.DefaultChannelName = stableChannel
@@ -1542,7 +1546,7 @@ var _ = Describe("Subscription", func() {
15421546
var cleanup cleanupFunc
15431547
By("creating catalogsources", func() {
15441548
var c1, c2 cleanupFunc
1545-
catsrc, c1 = createInternalCatalogSource(kubeClient, crClient, genName("catsrc"), generatedNamespace.GetName(), []registry.PackageManifest{packageA, packageB}, []apiextensionsv1.CustomResourceDefinition{crd, crd2}, csvs1)
1549+
catsrc, c1 = createInternalCatalogSource(kubeClient, crClient, genName("catsrc"), generatedNamespace.GetName(), []registry.PackageManifest{testPackage, anotherPackage}, []apiextensionsv1.CustomResourceDefinition{crd, crd2}, csvs1)
15461550
catsrc2, c2 = createInternalCatalogSource(kubeClient, crClient, genName("catsrc2"), generatedNamespace.GetName(), []registry.PackageManifest{packageBInCatsrc2, packageC}, []apiextensionsv1.CustomResourceDefinition{crd, crd2}, csvs2)
15471551
cleanup = func() {
15481552
c1()
@@ -1558,11 +1562,11 @@ var _ = Describe("Subscription", func() {
15581562
require.NoError(GinkgoT(), err)
15591563
})
15601564

1561-
By(`Create a subscription for packageA in catsrc`)
1565+
By(`Create a subscription for test-package in catsrc`)
15621566
subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{
15631567
CatalogSource: catsrc.GetName(),
15641568
CatalogSourceNamespace: catsrc.GetNamespace(),
1565-
Package: packageA.PackageName,
1569+
Package: testPackage.PackageName,
15661570
Channel: stableChannel,
15671571
InstallPlanApproval: operatorsv1alpha1.ApprovalAutomatic,
15681572
}
@@ -1668,7 +1672,7 @@ var _ = Describe("Subscription", func() {
16681672
var subscription *operatorsv1alpha1.Subscription
16691673

16701674
BeforeEach(func() {
1671-
By(`Create a subscription for packageA in catsrc`)
1675+
By(`Create a subscription for test-package in catsrc`)
16721676
subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{
16731677
CatalogSource: catsrcMain.GetName(),
16741678
CatalogSourceNamespace: catsrcMain.GetNamespace(),
@@ -1756,7 +1760,7 @@ var _ = Describe("Subscription", func() {
17561760
var subscription *operatorsv1alpha1.Subscription
17571761

17581762
BeforeEach(func() {
1759-
By(`Create a subscription for packageA in catsrc`)
1763+
By(`Create a subscription for test-package in catsrc`)
17601764
subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{
17611765
CatalogSource: catsrcMain.GetName(),
17621766
CatalogSourceNamespace: catsrcMain.GetNamespace(),
@@ -1850,7 +1854,7 @@ var _ = Describe("Subscription", func() {
18501854
var subscription *operatorsv1alpha1.Subscription
18511855

18521856
BeforeEach(func() {
1853-
By(`Create a subscription for packageA in catsrc`)
1857+
By(`Create a subscription for test-package in catsrc`)
18541858
subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{
18551859
CatalogSource: catsrcMain.GetName(),
18561860
CatalogSourceNamespace: catsrcMain.GetNamespace(),
@@ -1944,7 +1948,7 @@ var _ = Describe("Subscription", func() {
19441948
var subscription *operatorsv1alpha1.Subscription
19451949

19461950
BeforeEach(func() {
1947-
By(`Create a subscription for packageA in catsrc`)
1951+
By(`Create a subscription for test-package in catsrc`)
19481952
subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{
19491953
CatalogSource: catsrcMain.GetName(),
19501954
CatalogSourceNamespace: catsrcMain.GetNamespace(),
@@ -2156,7 +2160,7 @@ var _ = Describe("Subscription", func() {
21562160

21572161
packages = []registry.PackageManifest{
21582162
{
2159-
PackageName: "packageA",
2163+
PackageName: "test-package",
21602164
Channels: []registry.PackageChannel{
21612165
{Name: "alpha", CurrentCSVName: "csvA"},
21622166
},
@@ -2171,7 +2175,7 @@ var _ = Describe("Subscription", func() {
21712175
_, err := fetchCatalogSourceOnStatus(crc, catSrcName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced())
21722176
require.NoError(GinkgoT(), err)
21732177

2174-
cleanup = createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catSrcName, "packageA", "alpha", "", operatorsv1alpha1.ApprovalAutomatic)
2178+
cleanup = createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catSrcName, "test-package", "alpha", "", operatorsv1alpha1.ApprovalAutomatic)
21752179
})
21762180

21772181
AfterEach(func() {
@@ -2193,7 +2197,7 @@ var _ = Describe("Subscription", func() {
21932197

21942198
BeforeEach(func() {
21952199
newPkg := registry.PackageManifest{
2196-
PackageName: "PackageB",
2200+
PackageName: "another-package",
21972201
Channels: []registry.PackageChannel{
21982202
{Name: "alpha", CurrentCSVName: "csvB"},
21992203
},
@@ -2422,8 +2426,8 @@ var _ = Describe("Subscription", func() {
24222426
Expect(magicCatalog.DeployCatalog(context.Background())).To(BeNil())
24232427

24242428
By("creating the testing subscription")
2425-
subName = fmt.Sprintf("%s-packagea-sub", generatedNamespace.GetName())
2426-
createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catalogSourceName, "packageA", stableChannel, "", operatorsv1alpha1.ApprovalAutomatic)
2429+
subName = fmt.Sprintf("%s-test-package-sub", generatedNamespace.GetName())
2430+
createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catalogSourceName, "test-package", stableChannel, "", operatorsv1alpha1.ApprovalAutomatic)
24272431

24282432
By("waiting until the subscription has an IP reference")
24292433
subscription, err := fetchSubscription(crc, generatedNamespace.GetName(), subName, subscriptionHasInstallPlanChecker())
@@ -2594,13 +2598,11 @@ var _ = Describe("Subscription", func() {
25942598
Expect(err).To(BeNil())
25952599

25962600
By("waiting for the subscription to have v0.3.0 installed with a Package deprecated condition")
2597-
_, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, subscriptionDoesNotHaveCondition(operatorsv1alpha1.SubscriptionBundleDeprecated))
2598-
Expect(err).Should(BeNil())
25992601
sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, subscriptionHasCondition(
26002602
operatorsv1alpha1.SubscriptionPackageDeprecated,
26012603
corev1.ConditionTrue,
26022604
"",
2603-
"olm.package/packageA: packageA has been deprecated. Please switch to packageB."))
2605+
"olm.package/test-package: test-package has been deprecated. Please switch to another-package."))
26042606
Expect(err).Should(BeNil())
26052607

26062608
By("checking for the deprecated conditions")
@@ -2827,8 +2829,8 @@ properties:
28272829
Expect(magicCatalog.DeployCatalog(context.Background())).To(BeNil())
28282830

28292831
By("creating the testing subscription")
2830-
subName := fmt.Sprintf("%s-packagea-sub", generatedNamespace.GetName())
2831-
createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catalogSourceName, "packageA", stableChannel, "", operatorsv1alpha1.ApprovalAutomatic)
2832+
subName := fmt.Sprintf("%s-test-package-sub", generatedNamespace.GetName())
2833+
createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catalogSourceName, "test-package", stableChannel, "", operatorsv1alpha1.ApprovalAutomatic)
28322834

28332835
By("waiting until the subscription has an IP reference")
28342836
subscription, err := fetchSubscription(crc, generatedNamespace.GetName(), subName, subscriptionHasInstallPlanChecker())
@@ -3268,6 +3270,7 @@ func fetchSubscription(crc versioned.Interface, namespace, name string, checker
32683270
if thisState != lastState || thisCSV != lastCSV || !equality.Semantic.DeepEqual(thisInstallPlanRef, lastInstallPlanRef) {
32693271
lastState, lastCSV, lastInstallPlanRef = thisState, thisCSV, thisInstallPlanRef
32703272
log(fmt.Sprintf("subscription %s/%s state: %s (csv %s): installPlanRef: %#v", namespace, name, thisState, thisCSV, thisInstallPlanRef))
3273+
log(fmt.Sprintf("subscription %s/%s state: %s (csv %s): status: %#v", namespace, name, thisState, thisCSV, fetchedSubscription.Status))
32713274
}
32723275
return checker(fetchedSubscription), nil
32733276
})
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
schema: olm.package
3-
name: packageA
3+
name: test-package
44
defaultChannel: stable
55
---
66
schema: olm.channel
7-
package: packageA
7+
package: test-package
88
name: stable
99
entries:
1010
- name: bad-csv
1111
---
1212
schema: olm.bundle
1313
name: bad-csv
14-
package: packageA
14+
package: test-package
1515
image: quay.io/olmtest/missing_api_version:latest
1616
properties:
1717
- type: olm.gvk
@@ -21,5 +21,5 @@ properties:
2121
version: v1alpha1
2222
- type: olm.package
2323
value:
24-
packageName: packageA
24+
packageName: test-package
2525
version: 1.0.0

test/e2e/testdata/fail-forward/v0.1.0/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.1.0

test/e2e/testdata/fail-forward/v0.2.0-invalid-csv/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.2.0&invalid

test/e2e/testdata/fail-forward/v0.2.0-invalid-deployment/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.2.0

test/e2e/testdata/fail-forward/v0.2.1-invalid-csv/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.2.1&invalid

test/e2e/testdata/fail-forward/v0.3.0-replaces-invalid-csv/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.3.0

test/e2e/testdata/fail-forward/v0.3.0-replaces-invalid-deployment/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.3.0

test/e2e/testdata/fail-forward/v0.3.0-skip-range/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.3.0

test/e2e/testdata/fail-forward/v0.3.0-skips/packagemanifest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageName: packageA
1+
packageName: test-package
22
channels:
33
- name: stable
44
currentCSV: example-operator.v0.3.0

test/e2e/testdata/magiccatalog/fbc_catalog.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"schema": "olm.package",
3-
"name": "packageA",
3+
"name": "test-package",
44
"defaultChannel": "stable"
55
}
66
{
77
"schema": "olm.channel",
88
"name": "stable",
9-
"package": "packageA",
9+
"package": "test-package",
1010
"entries": [
1111
{
12-
"name": "packageA.v1.0.0"
12+
"name": "test-package.v1.0.0"
1313
}
1414
]
1515
}
1616
{
1717
"schema": "olm.bundle",
18-
"name": "packageA.v1.0.0",
19-
"package": "packageA",
20-
"image": "packageA:v1.0.0",
18+
"name": "test-package.v1.0.0",
19+
"package": "test-package",
20+
"image": "test-package:v1.0.0",
2121
"properties": [
2222
{
2323
"type": "olm.gvk",
@@ -30,7 +30,7 @@
3030
{
3131
"type": "olm.package",
3232
"value": {
33-
"packageName": "packageA",
33+
"packageName": "test-package",
3434
"version": "1.0.0"
3535
}
3636
}

0 commit comments

Comments
 (0)