Skip to content

Commit 060ce07

Browse files
stevekuznetsovtmshort
authored andcommitted
test/e2e/fail-forward: use internal catalogs, change failure mode
Previously, these tests intedend to cause failing InstallPlans by not providiing the ServiceAccount on the OperatorGroup sufficient permissions. Due to unrelated reasons, we've had to make insufficient permissions not a terminal failure mode (the user may always add them in...). Now, we achieve failing InstallPlans by using invalid Kubernetes objects in the bundles. We also use the internal CatalogSource instead of hosting our catalog data in Quay, as this allows us to skip waiting for image pulls from the registry and keep our test data in version control. Signed-off-by: Steve Kuznetsov <[email protected]>
1 parent d94ad8c commit 060ce07

29 files changed

+566
-234
lines changed

test/e2e/fail_forward_e2e_test.go

+198-93
Large diffs are not rendered by default.

test/e2e/subscription_e2e_test.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ const (
5353
interval = time.Millisecond * 100
5454
)
5555

56+
const (
57+
subscriptionTestDataBaseDir = "subscription/"
58+
)
59+
5660
var _ = Describe("Subscription", func() {
5761
var (
5862
generatedNamespace corev1.Namespace
@@ -2425,7 +2429,7 @@ var _ = Describe("Subscription", func() {
24252429

24262430
BeforeEach(func() {
24272431
By("deploying the testing catalog")
2428-
provider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, failForwardTestDataBaseDir, "example-operator.v0.1.0.yaml"))
2432+
provider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, subscriptionTestDataBaseDir, "example-operator.v0.1.0.yaml"))
24292433
Expect(err).To(BeNil())
24302434
catalogSourceName = fmt.Sprintf("%s-catsrc", generatedNamespace.GetName())
24312435
magicCatalog = NewMagicCatalog(ctx.Ctx().Client(), generatedNamespace.GetName(), catalogSourceName, provider)
@@ -2481,7 +2485,7 @@ var _ = Describe("Subscription", func() {
24812485
addBundleUnpackTimeoutOGAnnotation(context.Background(), ctx.Ctx().Client(), ogNN, "1s")
24822486

24832487
By("updating the catalog with a broken v0.2.0 bundle image")
2484-
brokenProvider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, failForwardTestDataBaseDir, "example-operator.v0.2.0-non-existent-tag.yaml"))
2488+
brokenProvider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, subscriptionTestDataBaseDir, "example-operator.v0.2.0-non-existent-tag.yaml"))
24852489
Expect(err).To(BeNil())
24862490
err = magicCatalog.UpdateCatalog(context.Background(), brokenProvider)
24872491
Expect(err).To(BeNil())
@@ -2516,7 +2520,7 @@ var _ = Describe("Subscription", func() {
25162520
addBundleUnpackTimeoutOGAnnotation(context.Background(), ctx.Ctx().Client(), ogNN, "5m")
25172521

25182522
By("updating the catalog with a fixed v0.2.0 bundle image")
2519-
brokenProvider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, failForwardTestDataBaseDir, "example-operator.v0.2.0.yaml"))
2523+
brokenProvider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, subscriptionTestDataBaseDir, "example-operator.v0.2.0.yaml"))
25202524
Expect(err).To(BeNil())
25212525
err = magicCatalog.UpdateCatalog(context.Background(), brokenProvider)
25222526
Expect(err).To(BeNil())
@@ -2685,7 +2689,7 @@ properties:
26852689

26862690
It("should not retry successful unpack jobs", func() {
26872691
By("deploying the testing catalog")
2688-
provider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, failForwardTestDataBaseDir, "example-operator.v0.1.0.yaml"))
2692+
provider, err := NewFileBasedFiledBasedCatalogProvider(filepath.Join(testdataDir, subscriptionTestDataBaseDir, "example-operator.v0.1.0.yaml"))
26892693
Expect(err).To(BeNil())
26902694
catalogSourceName := fmt.Sprintf("%s-catsrc", generatedNamespace.GetName())
26912695
magicCatalog := NewMagicCatalog(ctx.Ctx().Client(), generatedNamespace.GetName(), catalogSourceName, provider)

test/e2e/testdata/fail-forward/multiple-bad-versions/example-operator.v0.2.1-non-existent-tag.yaml

-28
This file was deleted.

test/e2e/testdata/fail-forward/multiple-bad-versions/example-operator.v0.3.0.yaml

-26
This file was deleted.

test/e2e/testdata/fail-forward/replaces/example-operator.v0.3.0.yaml

-26
This file was deleted.

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

-26
This file was deleted.

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

-28
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: ClusterServiceVersion
3+
metadata:
4+
name: example-operator.v0.1.0
5+
namespace: placeholder
6+
spec:
7+
displayName: Example Operator
8+
install:
9+
spec:
10+
deployments:
11+
- name: example-operator-controller-manager
12+
spec:
13+
replicas: 1
14+
selector:
15+
matchLabels:
16+
control-plane: controller-manager
17+
strategy: {}
18+
template:
19+
metadata:
20+
labels:
21+
control-plane: controller-manager
22+
spec:
23+
containers:
24+
- image: quay.io/openshift-scale/nginx:latest
25+
name: manager
26+
strategy: deployment
27+
installModes:
28+
- supported: false
29+
type: OwnNamespace
30+
- supported: false
31+
type: SingleNamespace
32+
- supported: false
33+
type: MultiNamespace
34+
- supported: true
35+
type: AllNamespaces
36+
maturity: alpha
37+
version: 0.1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
packageName: packageA
2+
channels:
3+
- name: stable
4+
currentCSV: example-operator.v0.1.0
5+
defaultChannel: stable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: ClusterServiceVersion
3+
metadata:
4+
name: example-operator.v0.2.0&invalid
5+
namespace: placeholder
6+
spec:
7+
replaces: example-operator.v0.1.0
8+
displayName: Example Operator
9+
install:
10+
spec:
11+
deployments:
12+
- name: example-operator-controller-manager
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
control-plane: controller-manager
18+
strategy: {}
19+
template:
20+
metadata:
21+
labels:
22+
control-plane: controller-manager
23+
spec:
24+
containers:
25+
- image: quay.io/openshift-scale/nginx:latest
26+
name: manager
27+
strategy: deployment
28+
installModes:
29+
- supported: false
30+
type: OwnNamespace
31+
- supported: false
32+
type: SingleNamespace
33+
- supported: false
34+
type: MultiNamespace
35+
- supported: true
36+
type: AllNamespaces
37+
maturity: alpha
38+
version: 0.2.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
packageName: packageA
2+
channels:
3+
- name: stable
4+
currentCSV: example-operator.v0.2.0&invalid
5+
defaultChannel: stable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: ClusterServiceVersion
3+
metadata:
4+
name: example-operator.v0.2.0
5+
namespace: placeholder
6+
spec:
7+
replaces: example-operator.v0.1.0
8+
displayName: Example Operator
9+
install:
10+
spec:
11+
deployments:
12+
- name: example-operator-controller-manager&invalid
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
control-plane: controller-manager
18+
strategy: {}
19+
template:
20+
metadata:
21+
labels:
22+
control-plane: controller-manager
23+
spec:
24+
containers:
25+
- image: quay.io/openshift-scale/nginx:latest
26+
name: manager
27+
strategy: deployment
28+
installModes:
29+
- supported: false
30+
type: OwnNamespace
31+
- supported: false
32+
type: SingleNamespace
33+
- supported: false
34+
type: MultiNamespace
35+
- supported: true
36+
type: AllNamespaces
37+
maturity: alpha
38+
version: 0.2.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
packageName: packageA
2+
channels:
3+
- name: stable
4+
currentCSV: example-operator.v0.2.0
5+
defaultChannel: stable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: ClusterServiceVersion
3+
metadata:
4+
name: example-operator.v0.2.1&invalid
5+
namespace: placeholder
6+
spec:
7+
skips:
8+
- example-operator.v0.1.0
9+
- example-operator.v0.2.0
10+
displayName: Example Operator
11+
install:
12+
spec:
13+
deployments:
14+
- name: example-operator-controller-manager
15+
spec:
16+
replicas: 1
17+
selector:
18+
matchLabels:
19+
control-plane: controller-manager
20+
strategy: {}
21+
template:
22+
metadata:
23+
labels:
24+
control-plane: controller-manager
25+
spec:
26+
containers:
27+
- image: quay.io/openshift-scale/nginx:latest
28+
name: manager
29+
strategy: deployment
30+
installModes:
31+
- supported: false
32+
type: OwnNamespace
33+
- supported: false
34+
type: SingleNamespace
35+
- supported: false
36+
type: MultiNamespace
37+
- supported: true
38+
type: AllNamespaces
39+
maturity: alpha
40+
version: 0.2.1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
packageName: packageA
2+
channels:
3+
- name: stable
4+
currentCSV: example-operator.v0.2.1&invalid
5+
defaultChannel: stable

0 commit comments

Comments
 (0)