Skip to content

🐛 Fix testCatalogName conflict - #2367

Merged
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
jianzhangbjz:e2e
Dec 2, 2025
Merged

🐛 Fix testCatalogName conflict#2367
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
jianzhangbjz:e2e

Conversation

@jianzhangbjz

@jianzhangbjzjianzhangbjz commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

Description

===RUNTestClusterExtensionVersionUpdate
single_namespace_support_test.go:361: Whenaclusterextensionisinstalledfromacatalog
single_namespace_support_test.go:362: Whenresolvingupgradeedges
helpers.go:229: ErrorTrace:	/home/runner/work/operator-controller/operator-controller/test/helpers/helpers.go:229
Error: Received unexpectederror:
objectisbeing deleted: clustercatalogs.olm.operatorframework.io"test-catalog"alreadyexists
Test: TestClusterExtensionVersionUpdate---FAIL: TestClusterExtensionVersionUpdate (0.01s)

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Assisted-by: Claude Code

@jianzhangbjz
jianzhangbjz requested a review from a team as a code ownerDecember 1, 2025 02:31
@netlify

netlifyBot commented Dec 1, 2025

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

NameLink
🔨 Latest commit33414a7
🔍 Latest deploy loghttps://app.netlify.com/projects/olmv1/deploys/692e426dfb88490008f0a9ab
😎 Deploy Previewhttps://deploy-preview-2367--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jianzhangbjz
jianzhangbjzforce-pushed the e2e branch 3 times, most recently from ad9ea17 to 18931abCompareDecember 1, 2025 04:24
@codecov

codecovBot commented Dec 1, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.51%. Comparing base (b23e124) to head (33414a7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #2367 +/- ##
==========================================
+ Coverage 70.58% 74.51% +3.92% 
==========================================
Files 93 93 Lines 7333 7333 ==========================================
+ Hits 5176 5464 +288 + Misses 1721 1435 -286 + Partials 436 434 -2 
FlagCoverage Δ
e2e44.51% <ø> (+0.04%)⬆️
experimental-e2e48.78% <ø> (?)
unit58.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dtfranz

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Dec 1, 2025
@jianzhangbjz

Copy link
Copy Markdown
ContributorAuthor

/approve

Comment threadtest/e2e/cluster_extension_install_test.go
@openshift-ciopenshift-ciBot removed the lgtm Indicates that a PR is ready to be merged. label Dec 1, 2025
@jianzhangbjz

Copy link
Copy Markdown
ContributorAuthor

It failed at the below, which I don't think this PR introduced it.

===RUNTestClusterExtensionRecoversFromExistingDeploymentWhenFailureFixed
cluster_extension_install_test.go:679: Whenaclusterextensionisinstalledfromacatalog
cluster_extension_install_test.go:680: Whentheextensionbundleformatisregistry+v1
helpers.go:263: EnsuringClusterCataloghas Status.ConditionofProgressingwithastatus==Trueandreason==Succeeded
helpers.go:273: Checkingthatcataloghastheexpectedmetadatalabel
helpers.go:278: EnsuringClusterCataloghas Status.ConditionofType=Servingwithstatus==True
cluster_extension_install_test.go:703: BycreatinganewDeploymentthatcannotbeadopted
cluster_extension_install_test.go:746: Itresolvesthespecifiedpackage with correctbundlepath
cluster_extension_install_test.go:747: BycreatingtheClusterExtensionresource
cluster_extension_install_test.go:750: ByeventuallyreportingProgressing==TruewithReasonRetrying
cluster_extension_install_test.go:751: ErrorTrace:	/home/runner/work/operator-controller/operator-controller/test/e2e/cluster_extension_install_test.go:756/opt/hostedtoolcache/go/1.24.6/x64/src/runtime/asm_amd64.s:1700
Error: Not equal: expected: "Retrying"
actual : "RolloutInProgress"
Diff:
---Expected+++Actual
@@ -1+1 @@
-Retrying+RolloutInProgress
cluster_extension_install_test.go:751: ErrorTrace:	/home/runner/work/operator-controller/operator-controller/test/e2e/cluster_extension_install_test.go:751
Error: Conditionneversatisfied
Test: TestClusterExtensionRecoversFromExistingDeploymentWhenFailureFixed
helpers.go:321: BydeletingClusterCatalog "test-catalog-x8krz9gf"
helpers.go:330: BydeletingClusterExtension"clusterextension-p8zl88ng"
helpers.go:294: BywaitingforCustomResourceDefinitionsof"clusterextension-p8zl88ng"tobedeleted
helpers.go:302: BywaitingforClusterRoleBindingsof"clusterextension-p8zl88ng"tobedeleted
helpers.go:310: BywaitingforClusterRolesof"clusterextension-p8zl88ng"tobedeleted
helpers.go:340: BydeletingServiceAccount"clusterextension-p8zl88ng"
helpers.go:349: BydeletingNamespace"clusterextension-p8zl88ng"---FAIL: TestClusterExtensionRecoversFromExistingDeploymentWhenFailureFixed (106.27s)

@jianzhangbjz

Copy link
Copy Markdown
ContributorAuthor

Anyway, fix this in this PR.

@jianzhangbjzjianzhangbjz changed the title 🐛 fix testCatalogName conflict🐛 Fix testCatalogName conflict and Explicitly set CollisionProtection to Prevent in GenerateRevisionDec 1, 2025
@perdasilva

Copy link
Copy Markdown
Contributor

/approve

@openshift-ciopenshift-ciBot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 1, 2025
@jianzhangbjz

Copy link
Copy Markdown
ContributorAuthor

/retest

@rashmigottipatirashmigottipati left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Dec 1, 2025
Comment on lines +78 to +81
// If the CRD doesn't exist (e.g., in non-experimental environments), skip this step silently
if !apierrors.IsNotFound(err) && !strings.Contains(err.Error(), "no matches for kind") {
fmt.Printf("Failed to list cluster extension revisions: %v\n", err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this change need, it only reduces maybe a number of cases where this is printed out. BTW, we should log it, not print out directly on the console.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. I will remove it.

objs = append(objs, ocv1.ClusterExtensionRevisionObject{
Object: unstr,
Object: unstr,
CollisionProtection: ocv1.CollisionProtectionPrevent,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is really not necessary, because in the CRD the default value is already and it going to applied by API server if missing from the payload. Server-side apply works like this:

  • patch with the values that controllers is interested to managed are sent to API server
  • API server applies the patch,
  • applies defaults for the missing fields,
  • perform validations
  • persist the resource in etcd.

I have deployed OLM from the latest main, and created simple test-extension:

apiVersion: olm.operatorframework.io/v1kind: ClusterExtensionmetadata:
name: test-clusterextensionspec:
namespace: fooserviceAccount:
name: test-operator-installer-sasource:
catalog:
packageName: testselector:
matchLabels:
olm.operatorframework.io/metadata.name: test-catalogupgradeConstraintPolicy: SelfCertifiedversion: 1.0.0sourceType: Catalog

and the created revision contains the default collision protection:

apiVersion: olm.operatorframework.io/v1kind: ClusterExtensionRevisionmetadata:
annotations:
olm.operatorframework.io/bundle-name: test-operator.1.0.0olm.operatorframework.io/bundle-reference: docker-registry.operator-controller-e2e.svc.cluster.local:5000/bundles/registry-v1/test-operator:v1.0.0olm.operatorframework.io/bundle-version: 1.0.0olm.operatorframework.io/package-name: testcreationTimestamp: "2025-12-01T15:10:21Z"finalizers:
- olm.operatorframework.io/teardowngeneration: 1labels:
olm.operatorframework.io/owner-name: test-clusterextensionname: test-clusterextension-1spec:
lifecycleState: Activephases:
- name: policiesobjects:
- collisionProtection: Preventobject:
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:
labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: test-operator-network-policynamespace: foospec:
podSelector: {}policyTypes:
- Ingress
- name: rbacobjects:
- collisionProtection: Preventobject:
apiVersion: v1kind: ServiceAccountmetadata:
labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: simple-bundle-managernamespace: foo
- collisionProtection: Preventobject:
apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:
labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: testoperator.v1.0.-1eqned1rve17v8ggw7pxcudwuwxtutac7n2t3grh27tmrules:
- apiGroups:
- ""resources:
- configmaps
- serviceaccountsverbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- networking.k8s.ioresources:
- networkpoliciesverbs:
- get
- list
- create
- update
- delete
- apiGroups:
- coordination.k8s.ioresources:
- leasesverbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""resources:
- eventsverbs:
- create
- patch
- apiGroups:
- ""resources:
- namespacesverbs:
- get
- list
- watch
- collisionProtection: Preventobject:
apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:
labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: testoperator.v1.0.0-t88i5epjh8oxp4klplhjyrsekwcp92b27w03ayr1ku5rules:
- apiGroups:
- authentication.k8s.ioresources:
- tokenreviewsverbs:
- create
- apiGroups:
- authorization.k8s.ioresources:
- subjectaccessreviewsverbs:
- create
- collisionProtection: Preventobject:
apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata:
labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: testoperator.v1.0.-1eqned1rve17v8ggw7pxcudwuwxtutac7n2t3grh27tmroleRef:
apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: testoperator.v1.0.-1eqned1rve17v8ggw7pxcudwuwxtutac7n2t3grh27tmsubjects:
- kind: ServiceAccountname: simple-bundle-managernamespace: foo
- collisionProtection: Preventobject:
apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata:
labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: testoperator.v1.0.0-t88i5epjh8oxp4klplhjyrsekwcp92b27w03ayr1ku5roleRef:
apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: testoperator.v1.0.0-t88i5epjh8oxp4klplhjyrsekwcp92b27w03ayr1ku5subjects:
- kind: ServiceAccountname: simple-bundle-managernamespace: foo
- name: crdsobjects:
- collisionProtection: Preventobject:
apiVersion: apiextensions.k8s.io/v1kind: CustomResourceDefinitionmetadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: olme2etests.olm.operatorframework.iospec:
group: olm.operatorframework.ionames:
kind: OLME2ETestlistKind: OLME2ETestListplural: olme2etestssingular: olme2etestscope: Clusterversions:
- name: v1schema:
openAPIV3Schema:
properties:
spec:
properties:
testField:
type: stringtype: objecttype: objectserved: truestorage: true
- name: deployobjects:
- collisionProtection: Preventobject:
apiVersion: v1data:
httpd.sh: | #!/bin/sh echo true > /var/www/started echo true > /var/www/ready echo true > /var/www/live exec httpd -f -h /var/www -p 80kind: ConfigMapmetadata:
labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: httpd-scriptnamespace: foo
- collisionProtection: Preventobject:
apiVersion: v1data:
name: test-configmapversion: v1.0.0kind: ConfigMapmetadata:
annotations:
shouldNotTemplate: | The namespace is {{ $labels.namespace }}. The templated $labels.namespace is NOT expected to be processed by OLM's rendering engine for registry+v1 bundles.labels:
olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: test-configmapnamespace: foo
- collisionProtection: Preventobject:
apiVersion: apps/v1kind: Deploymentmetadata:
labels:
app.kubernetes.io/component: controllerapp.kubernetes.io/name: test-operatorapp.kubernetes.io/version: 1.0.0olm.operatorframework.io/owner-kind: ClusterExtensionolm.operatorframework.io/owner-name: test-clusterextensionname: test-operatornamespace: foospec:
replicas: 1revisionHistoryLimit: 1selector:
matchLabels:
app: olme2eteststrategy: {}template:
metadata:
annotations:
alm-examples: |- [ { "apiVersion": "olme2etests.olm.operatorframework.io/v1", "kind": "OLME2ETests", "metadata": { "labels": { "app.kubernetes.io/managed-by": "kustomize", "app.kubernetes.io/name": "test" }, "name": "test-sample" }, "spec": null } ]capabilities: Basic InstallcreatedAt: "2024-10-24T19:21:40Z"olm.targetNamespaces: ""operators.operatorframework.io/builder: operator-sdk-v1.34.1operators.operatorframework.io/project_layout: go.kubebuilder.io/v4labels:
app: olme2etestspec:
containers:
- command:
- /scripts/httpd.shimage: busybox:1.36livenessProbe:
failureThreshold: 1httpGet:
path: /liveport: 80periodSeconds: 2name: busybox-httpd-containerports:
- containerPort: 80readinessProbe:
httpGet:
path: /readyport: 80initialDelaySeconds: 1periodSeconds: 1resources: {}startupProbe:
failureThreshold: 30httpGet:
path: /startedport: 80periodSeconds: 10volumeMounts:
- mountPath: /scriptsname: scriptsreadOnly: trueserviceAccountName: simple-bundle-managerterminationGracePeriodSeconds: 0volumes:
- configMap:
defaultMode: 493name: httpd-scriptname: scriptsrevision: 1

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're correct. I will revert it.

@openshift-ciopenshift-ciBot removed the lgtm Indicates that a PR is ready to be merged. label Dec 1, 2025
@jianzhangbjzjianzhangbjz changed the title 🐛 Fix testCatalogName conflict and Explicitly set CollisionProtection to Prevent in GenerateRevision🐛 Fix testCatalogName conflictDec 2, 2025
@perdasilva

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Dec 2, 2025
@openshift-merge-bot
openshift-merge-botBot merged commit 34394ce into operator-framework:mainDec 2, 2025
28 checks passed

@pedjakpedjak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jianzhangbjz, pedjak, perdasilva, rashmigottipati

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by an approver from all required OWNERS files.lgtmIndicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@jianzhangbjz@dtfranz@perdasilva@pedjak@rashmigottipati