Skip to content

🌱 [Monorepo]: Cleanup: Merge catalogd-e2e tests into operator-controller e2e #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -221,21 +221,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
Loading