Skip to content

Conversation

@rohanKanojia
Copy link
Member

What does this PR do?

This PR adds comprehensive unit tests for OpenShift-specific RBAC functionality in the backupcronjob controller. These tests cover the creation and validation of Roles, RoleBindings, and ImageStreams required for workspace backups to the OpenShift internal registry.

The test suite includes three main test scenarios:

  1. ensureJobRunnerRBAC OpenShift functionality - Verifies that on OpenShift platforms, both RoleBinding and ImageStream resources are created with proper configuration
  2. ensureImagePushRoleBinding - Tests RoleBinding creation with correct ClusterRole reference (system:image-builder), ServiceAccount subjects, and proper labeling
  3. ensureImageStreamForBackup - Validates ImageStream resource creation with correct GVK, metadata, and spec configuration

These unit tests ensure that the backup cronjob controller correctly sets up the necessary RBAC permissions and resources to push backup images to the OpenShift internal registry.

What issues does this PR fix or reference?

Relates to #1572 - This PR adds test coverage that would have caught the authentication regression where the role name was accidentally changed from system:image-builder to system:image-puller, which prevented backup jobs from pushing images to the OpenShift internal registry.

Is it tested? How?

This PR only adds unit tests, it can be verified by running make test

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

@dkwon17
Copy link
Collaborator

dkwon17 commented Feb 12, 2026

LGTM
image

@openshift-ci
Copy link

openshift-ci bot commented Feb 12, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dkwon17, rohanKanojia

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

…tionality

Add comprehensive unit tests for OpenShift RBAC-related functions in the backup
cronjob controller, covering role and role binding generation for backup jobs.

Signed-off-by: Rohan Kumar <[email protected]>
@rohanKanojia rohanKanojia force-pushed the pr/test-backupcronjob-rbac branch from 66b2ae9 to 0081165 Compare February 12, 2026 04:03
@openshift-ci openshift-ci bot removed the lgtm label Feb 12, 2026
@openshift-ci
Copy link

openshift-ci bot commented Feb 12, 2026

New changes are detected. LGTM label has been removed.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants