Skip to content

Commit

Permalink
[Monorepo]: Cleanup: Merge catalogd-e2e tests into `operator-contro…
Browse files Browse the repository at this point in the history
…ller` e2e (#1757)

- Removed `gingko` and `omega` from `unpack_test`.
- Ensured that `unpack_test` previously under `catalogd-e2e` is now executed alongside other `operator-controller` e2e tests.
  • Loading branch information
camilamacedo86 authored Feb 14, 2025
1 parent 237ec1c commit 7146a7a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 179 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/catalogd-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ on:
- main

jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run E2e
run: make test-catalogd-e2e
upgrade-e2e:
runs-on: ubuntu-latest
steps:
Expand Down
14 changes: 1 addition & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,21 +223,9 @@ image-registry: ## Build the testdata catalog used for e2e tests and push it to
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
test-e2e: KUSTOMIZE_BUILD_DIR := config/overlays/e2e
test-e2e: GO_BUILD_FLAGS := -cover
test-e2e: CATALOGD_KUSTOMIZE_BUILD_DIR := catalogd/config/overlays/e2e
test-e2e: run image-registry e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster

# Catalogd e2e tests
FOCUS := $(if $(TEST),-v -focus "$(TEST)")
ifeq ($(origin E2E_FLAGS), undefined)
E2E_FLAGS :=
endif
test-catalogd-e2e: ## Run the e2e tests on existing cluster
$(GINKGO) $(E2E_FLAGS) -trace -vv $(FOCUS) test/catalogd-e2e

catalogd-e2e: KIND_CLUSTER_NAME := catalogd-e2e
catalogd-e2e: ISSUER_KIND := Issuer
catalogd-e2e: ISSUER_NAME := selfsigned-issuer
catalogd-e2e: CATALOGD_KUSTOMIZE_BUILD_DIR := catalogd/config/overlays/e2e
catalogd-e2e: run catalogd-image-registry test-catalogd-e2e ## kind-clean Run e2e test suite on local kind cluster

## image-registry target has to come after run-latest-release,
## because the image-registry depends on the olm-ca issuer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ metadata:
data:
registries.conf: |
[[registry]]
prefix = "docker-registry.catalogd-e2e.svc:5000"
insecure = true
location = "docker-registry.catalogd-e2e.svc:5000"
prefix = "mirrored-registry.operator-controller-e2e.svc.cluster.local:5000"
location = "docker-registry.operator-controller-e2e.svc.cluster.local:5000"
49 changes: 0 additions & 49 deletions test/catalogd-e2e/e2e_suite_test.go

This file was deleted.

105 changes: 0 additions & 105 deletions test/catalogd-e2e/unpack_test.go

This file was deleted.

31 changes: 31 additions & 0 deletions test/e2e/cluster_extension_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,40 @@ func testInit(t *testing.T) (*ocv1.ClusterExtension, *catalogd.ClusterCatalog, *

sa, err := createServiceAccount(context.Background(), name, clusterExtensionName)
require.NoError(t, err)

validateCatalogUnpack(t)

return clusterExtension, extensionCatalog, sa, ns
}

func validateCatalogUnpack(t *testing.T) {
catalog := &catalogd.ClusterCatalog{}
t.Log("Ensuring ClusterCatalog has Status.Condition of Progressing with a status == True and reason == Succeeded")
require.EventuallyWithT(t, func(ct *assert.CollectT) {
err := c.Get(context.Background(), types.NamespacedName{Name: testCatalogName}, catalog)
assert.NoError(ct, err)
cond := apimeta.FindStatusCondition(catalog.Status.Conditions, catalogd.TypeProgressing)
assert.NotNil(ct, cond)
assert.Equal(ct, metav1.ConditionTrue, cond.Status)
assert.Equal(ct, catalogd.ReasonSucceeded, cond.Reason)
}, pollDuration, pollInterval)

t.Log("Checking that catalog has the expected metadata label")
assert.NotNil(t, catalog.ObjectMeta.Labels)
assert.Contains(t, catalog.ObjectMeta.Labels, "olm.operatorframework.io/metadata.name")
assert.Equal(t, testCatalogName, catalog.ObjectMeta.Labels["olm.operatorframework.io/metadata.name"])

t.Log("Ensuring ClusterCatalog has Status.Condition of Type = Serving with status == True")
require.EventuallyWithT(t, func(ct *assert.CollectT) {
err := c.Get(context.Background(), types.NamespacedName{Name: testCatalogName}, catalog)
assert.NoError(ct, err)
cond := apimeta.FindStatusCondition(catalog.Status.Conditions, catalogd.TypeServing)
assert.NotNil(ct, cond)
assert.Equal(ct, metav1.ConditionTrue, cond.Status)
assert.Equal(ct, catalogd.ReasonAvailable, cond.Reason)
}, pollDuration, pollInterval)
}

func ensureNoExtensionResources(t *testing.T, clusterExtensionName string) {
ls := labels.Set{"olm.operatorframework.io/owner-name": clusterExtensionName}

Expand Down

0 comments on commit 7146a7a

Please sign in to comment.