Skip to content

Commit be4f081

Browse files
UPSTREAM: <carry>: [OTE] add catalog tests from openshift/origin
This commit migrates the olmv1_catalog set of tests from openshift/origin to OTE as part the broad effort to migrate all tests. Assisted-by: Gemini
1 parent 778bd57 commit be4f081

File tree

4 files changed

+407
-4
lines changed

4 files changed

+407
-4
lines changed

openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,104 @@
11
[
2+
{
3+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 Catalogs should be installed",
4+
"labels": {},
5+
"resources": {
6+
"isolation": {}
7+
},
8+
"source": "openshift:payload:olmv1",
9+
"lifecycle": "blocking",
10+
"environmentSelector": {}
11+
},
12+
{
13+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 openshift-community-operators Catalog should serve FBC via the /v1/api/all endpoint",
14+
"labels": {},
15+
"resources": {
16+
"isolation": {}
17+
},
18+
"source": "openshift:payload:olmv1",
19+
"lifecycle": "blocking",
20+
"environmentSelector": {}
21+
},
22+
{
23+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 openshift-certified-operators Catalog should serve FBC via the /v1/api/all endpoint",
24+
"labels": {},
25+
"resources": {
26+
"isolation": {}
27+
},
28+
"source": "openshift:payload:olmv1",
29+
"lifecycle": "blocking",
30+
"environmentSelector": {}
31+
},
32+
{
33+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 openshift-redhat-marketplace Catalog should serve FBC via the /v1/api/all endpoint",
34+
"labels": {},
35+
"resources": {
36+
"isolation": {}
37+
},
38+
"source": "openshift:payload:olmv1",
39+
"lifecycle": "blocking",
40+
"environmentSelector": {}
41+
},
42+
{
43+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 openshift-redhat-operators Catalog should serve FBC via the /v1/api/all endpoint",
44+
"labels": {},
45+
"resources": {
46+
"isolation": {}
47+
},
48+
"source": "openshift:payload:olmv1",
49+
"lifecycle": "blocking",
50+
"environmentSelector": {}
51+
},
52+
{
53+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMCatalogdAPIV1Metas][Skipped:Disconnected] OLMv1 openshift-community-operators Catalog should serve FBC via the /v1/api/metas endpoint",
54+
"labels": {},
55+
"resources": {
56+
"isolation": {}
57+
},
58+
"source": "openshift:payload:olmv1",
59+
"lifecycle": "blocking",
60+
"environmentSelector": {}
61+
},
62+
{
63+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMCatalogdAPIV1Metas][Skipped:Disconnected] OLMv1 openshift-certified-operators Catalog should serve FBC via the /v1/api/metas endpoint",
64+
"labels": {},
65+
"resources": {
66+
"isolation": {}
67+
},
68+
"source": "openshift:payload:olmv1",
69+
"lifecycle": "blocking",
70+
"environmentSelector": {}
71+
},
72+
{
73+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMCatalogdAPIV1Metas][Skipped:Disconnected] OLMv1 openshift-redhat-marketplace Catalog should serve FBC via the /v1/api/metas endpoint",
74+
"labels": {},
75+
"resources": {
76+
"isolation": {}
77+
},
78+
"source": "openshift:payload:olmv1",
79+
"lifecycle": "blocking",
80+
"environmentSelector": {}
81+
},
82+
{
83+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMCatalogdAPIV1Metas][Skipped:Disconnected] OLMv1 openshift-redhat-operators Catalog should serve FBC via the /v1/api/metas endpoint",
84+
"labels": {},
85+
"resources": {
86+
"isolation": {}
87+
},
88+
"source": "openshift:payload:olmv1",
89+
"lifecycle": "blocking",
90+
"environmentSelector": {}
91+
},
92+
{
93+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 New Catalog Install should fail to install if it has an invalid reference",
94+
"labels": {},
95+
"resources": {
96+
"isolation": {}
97+
},
98+
"source": "openshift:payload:olmv1",
99+
"lifecycle": "blocking",
100+
"environmentSelector": {}
101+
},
2102
{
3103
"name": "[sig-olmv1] OLMv1 should pass a trivial sanity check",
4104
"labels": {},
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package helpers
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+
9+
olmv1 "github.com/operator-framework/operator-controller/api/v1"
10+
11+
"github/operator-framework-operator-controller/openshift/tests-extension/pkg/env"
12+
)
13+
14+
// CreateClusterCatalog creates a ClusterCatalog with the specified name and image reference
15+
// Returns a cleanup function to delete the catalog after use.
16+
func CreateClusterCatalog(ctx context.Context, name, imageRef string) (func(), error) {
17+
k8sClient := env.Get().K8sClient
18+
19+
catalog := &olmv1.ClusterCatalog{
20+
ObjectMeta: metav1.ObjectMeta{
21+
Name: name,
22+
},
23+
Spec: olmv1.ClusterCatalogSpec{
24+
Source: olmv1.CatalogSource{
25+
Type: olmv1.SourceTypeImage,
26+
Image: &olmv1.ImageSource{
27+
Ref: imageRef,
28+
},
29+
},
30+
},
31+
}
32+
33+
if err := k8sClient.Create(ctx, catalog); err != nil {
34+
return nil, fmt.Errorf("failed to create ClusterCatalog: %w", err)
35+
}
36+
37+
return func() {
38+
_ = k8sClient.Delete(ctx, &olmv1.ClusterCatalog{
39+
ObjectMeta: metav1.ObjectMeta{
40+
Name: name,
41+
},
42+
})
43+
}, nil
44+
}

openshift/tests-extension/pkg/helpers/cluster_extension.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ func CreateClusterExtension(packageName, version string) (string, func()) {
3636
Namespace: openshiftOperatorsNs,
3737
},
3838
}
39-
Expect(k8sClient.Create(ctx, sa)).To(Succeed(), "failed to create ServiceAccount")
39+
Expect(k8sClient.Create(ctx, sa)).To(Succeed(),
40+
"failed to create ServiceAccount")
4041

4142
// 2. Create ClusterRoleBinding
4243
crb := &rbacv1.ClusterRoleBinding{
@@ -54,7 +55,8 @@ func CreateClusterExtension(packageName, version string) (string, func()) {
5455
Namespace: openshiftOperatorsNs,
5556
}},
5657
}
57-
Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding")
58+
Expect(k8sClient.Create(ctx, crb)).To(Succeed(),
59+
"failed to create ClusterRoleBinding")
5860

5961
// 3. Create ClusterExtension
6062
ce := &ocv1.ClusterExtension{
@@ -77,9 +79,9 @@ func CreateClusterExtension(packageName, version string) (string, func()) {
7779
},
7880
},
7981
}
80-
Expect(k8sClient.Create(ctx, ce)).To(Succeed(), "failed to create ClusterExtension")
82+
Expect(k8sClient.Create(ctx, ce)).To(Succeed(),
83+
"failed to create ClusterExtension")
8184

82-
// Cleanup closure
8385
return ceName, func() {
8486
_ = k8sClient.Delete(ctx, ce)
8587
_ = k8sClient.Delete(ctx, crb)

0 commit comments

Comments
 (0)