Skip to content

Commit

Permalink
ci: Add support for configuring the global catalog namespace (#2825)
Browse files Browse the repository at this point in the history
Signed-off-by: timflannagan <timflannagan@gmail.com>
  • Loading branch information
timflannagan authored Jul 29, 2022
1 parent 0fa6f29 commit c652154
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ TEST := $(shell go run ./test/e2e/split/... -chunks $(E2E_TEST_NUM_CHUNKS) -prin
endif
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
E2E_INSTALL_NS ?= operator-lifecycle-manager
E2E_CATALOG_NS ?= $(E2E_INSTALL_NS)
E2E_TEST_NS ?= operators

e2e:
$(GINKGO) $(E2E_OPTS) $(or $(run), ./test/e2e) $< -- -namespace=$(E2E_TEST_NS) -olmNamespace=$(E2E_INSTALL_NS) -dummyImage=bitnami/nginx:latest $(or $(extra_args), -kubeconfig=${KUBECONFIG})
$(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})

# See workflows/e2e-tests.yml See test/e2e/README.md for details.
.PHONY: e2e-local
Expand Down
13 changes: 1 addition & 12 deletions test/e2e/catalog_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,6 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
})

It("global update triggers subscription sync", func() {
globalNS := operatorNamespace

// Determine which namespace is global. Should be `openshift-marketplace` for OCP 4.2+.
// Locally it is `olm`
namespaces, _ := c.KubernetesInterface().CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{})
for _, ns := range namespaces.Items {
if ns.GetName() == "openshift-marketplace" {
globalNS = "openshift-marketplace"
}
}

mainPackageName := genName("nginx-")

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

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

// Attempt to get the catalog source before creating install plan
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/catalog_exclusion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
globalCatalog := &v1alpha1.CatalogSource{
ObjectMeta: metav1.ObjectMeta{
Name: genName("bad-global-catalog-"),
Namespace: operatorNamespace,
Namespace: globalCatalogNamespace,
},
Spec: v1alpha1.CatalogSourceSpec{
DisplayName: "Broken Global Catalog Source",
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var (
olmNamespace = flag.String(
"olmNamespace", "", "namespace where olm is running")

catalogNamespace = flag.String(
"catalogNamespace", "", "namespace where the global catalog content is stored")

communityOperators = flag.String(
"communityOperators",
"quay.io/operator-framework/upstream-community-operators@sha256:098457dc5e0b6ca9599bd0e7a67809f8eca397907ca4d93597380511db478fec",
Expand Down Expand Up @@ -54,6 +57,7 @@ var (
testNamespace = ""
operatorNamespace = ""
communityOperatorsImage = ""
globalCatalogNamespace = ""
junitDir = "junit"
)

Expand Down Expand Up @@ -82,6 +86,7 @@ var _ = BeforeSuite(func() {
testNamespace = *namespace
operatorNamespace = *olmNamespace
communityOperatorsImage = *communityOperators
globalCatalogNamespace = *catalogNamespace
testdataDir = *testdataPath
deprovision = ctx.MustProvision(ctx.Ctx())
ctx.MustInstall(ctx.Ctx())
Expand Down

0 comments on commit c652154

Please sign in to comment.