Skip to content

Commit c652154

Browse files
authored
ci: Add support for configuring the global catalog namespace (#2825)
Signed-off-by: timflannagan <[email protected]>
1 parent 0fa6f29 commit c652154

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ TEST := $(shell go run ./test/e2e/split/... -chunks $(E2E_TEST_NUM_CHUNKS) -prin
134134
endif
135135
E2E_OPTS ?= $(if $(E2E_SEED),-seed '$(E2E_SEED)') $(if $(SKIP), -skip '$(SKIP)') $(if $(TEST),-focus '$(TEST)') $(if $(ARTIFACT_DIR), -output-dir $(ARTIFACT_DIR) -junit-report junit_e2e.xml) -flake-attempts $(E2E_FLAKE_ATTEMPTS) -nodes $(E2E_NODES) -timeout $(E2E_TIMEOUT) -v -randomize-suites -race -trace -progress
136136
E2E_INSTALL_NS ?= operator-lifecycle-manager
137+
E2E_CATALOG_NS ?= $(E2E_INSTALL_NS)
137138
E2E_TEST_NS ?= operators
138139

139140
e2e:
140-
$(GINKGO) $(E2E_OPTS) $(or $(run), ./test/e2e) $< -- -namespace=$(E2E_TEST_NS) -olmNamespace=$(E2E_INSTALL_NS) -dummyImage=bitnami/nginx:latest $(or $(extra_args), -kubeconfig=${KUBECONFIG})
141+
$(GINKGO) $(E2E_OPTS) $(or $(run), ./test/e2e) $< -- -namespace=$(E2E_TEST_NS) -olmNamespace=$(E2E_INSTALL_NS) -catalogNamespace=$(E2E_CATALOG_NS) -dummyImage=bitnami/nginx:latest $(or $(extra_args), -kubeconfig=${KUBECONFIG})
141142

142143
# See workflows/e2e-tests.yml See test/e2e/README.md for details.
143144
.PHONY: e2e-local

test/e2e/catalog_e2e_test.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,6 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
131131
})
132132

133133
It("global update triggers subscription sync", func() {
134-
globalNS := operatorNamespace
135-
136-
// Determine which namespace is global. Should be `openshift-marketplace` for OCP 4.2+.
137-
// Locally it is `olm`
138-
namespaces, _ := c.KubernetesInterface().CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{})
139-
for _, ns := range namespaces.Items {
140-
if ns.GetName() == "openshift-marketplace" {
141-
globalNS = "openshift-marketplace"
142-
}
143-
}
144-
145134
mainPackageName := genName("nginx-")
146135

147136
mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName)
@@ -179,7 +168,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
179168
}
180169

181170
// Create the initial catalog source
182-
cs, cleanup := createInternalCatalogSource(c, crc, mainCatalogName, globalNS, mainManifests, []apiextensions.CustomResourceDefinition{mainCRD}, []v1alpha1.ClusterServiceVersion{mainCSV})
171+
cs, cleanup := createInternalCatalogSource(c, crc, mainCatalogName, globalCatalogNamespace, mainManifests, []apiextensions.CustomResourceDefinition{mainCRD}, []v1alpha1.ClusterServiceVersion{mainCSV})
183172
defer cleanup()
184173

185174
// Attempt to get the catalog source before creating install plan

test/e2e/catalog_exclusion_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
4848
globalCatalog := &v1alpha1.CatalogSource{
4949
ObjectMeta: metav1.ObjectMeta{
5050
Name: genName("bad-global-catalog-"),
51-
Namespace: operatorNamespace,
51+
Namespace: globalCatalogNamespace,
5252
},
5353
Spec: v1alpha1.CatalogSourceSpec{
5454
DisplayName: "Broken Global Catalog Source",

test/e2e/e2e_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ var (
2626
olmNamespace = flag.String(
2727
"olmNamespace", "", "namespace where olm is running")
2828

29+
catalogNamespace = flag.String(
30+
"catalogNamespace", "", "namespace where the global catalog content is stored")
31+
2932
communityOperators = flag.String(
3033
"communityOperators",
3134
"quay.io/operator-framework/upstream-community-operators@sha256:098457dc5e0b6ca9599bd0e7a67809f8eca397907ca4d93597380511db478fec",
@@ -54,6 +57,7 @@ var (
5457
testNamespace = ""
5558
operatorNamespace = ""
5659
communityOperatorsImage = ""
60+
globalCatalogNamespace = ""
5761
junitDir = "junit"
5862
)
5963

@@ -82,6 +86,7 @@ var _ = BeforeSuite(func() {
8286
testNamespace = *namespace
8387
operatorNamespace = *olmNamespace
8488
communityOperatorsImage = *communityOperators
89+
globalCatalogNamespace = *catalogNamespace
8590
testdataDir = *testdataPath
8691
deprovision = ctx.MustProvision(ctx.Ctx())
8792
ctx.MustInstall(ctx.Ctx())

0 commit comments

Comments
 (0)