Skip to content

Conversation

@ropatil010
Copy link
Contributor

Hi Team,

Changes:

  1. File Structure (matching test/e2e pattern):

    • Created encryption.go - Ginkgo test implementation with g.Describe/g.It
    • Modified encryption_test.go - Traditional test wrappers for backward compatibility
    • Removed main_test.go - No longer needed (Ginkgo has built-in randomization)
  2. Test Implementation:

    • Wrapped tests in g.Describe("[sig-auth] authentication operator", ...)
    • Tagged with [Encryption][Serial] (matches Makefile -p 1 -parallel 1 config)
    • Tests use testXxx(testing.TB) functions for shared logic
    • Traditional TestXxx(t *testing.T) wrappers call testXxx(t)
  3. OTE Integration:

    • Added import for test/e2e-encryption package
    • Created encryption/serial suite with parallelism=1
    • Tests discoverable via openshift-tests-extension binary

Test Configuration (from Makefile line 59-66):

  • Marked as serial: "extremely slow serial e2e encryption tests"
  • Run with: -p 1 -parallel 1 -timeout 4h
  • Modify cluster global state (require serial execution)

Tests Migrated:

  • TestEncryptionTypeIdentity
  • TestEncryptionTypeUnset
  • TestEncryptionTurnOnAndOff

Verified:

  • go build ./test/e2e-encryption/... ✓
  • All 3 tests discovered by OTE ✓
  • Suite configured with parallelism=1 ✓

Need to remove the fail cmd/**/main.go file once hte PR: #833 gets merged.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds multiple new end-to-end test suites and helpers for the cluster-authentication-operator: encryption (core, perf, rotation), external OIDC, test-library TB adapters, and multiple test registry suites; refactors tests to delegate to TB wrappers and removes a custom test-order randomizer.

Changes

Cohort / File(s) Summary
Test registry
cmd/cluster-authentication-operator-tests-ext/main.go
Adds blank imports for new test packages and registers multiple new suites: operator parallel/serial, several encryption serial suites (core, rotation, perf, kms), and an OIDC parallel suite; adjusts suite filtering and parallelism.
Encryption e2e (core)
test/e2e-encryption/encryption.go, test/e2e-encryption/encryption_test.go, test/e2e-encryption/main_test.go
Adds Ginkgo-based encryption test implementations (three scenarios) and refactors public tests to delegate to wrapper helpers; removes custom TestMain-based test-order randomizer.
Encryption perf
test/e2e-encryption-perf/encryption_perf.go, test/e2e-encryption-perf/encryption_perf_test.go
Adds a performance encryption test (DB loaders, token creation, perf assertions) and simplifies public test to a single delegation to the new helper.
Encryption rotation
test/e2e-encryption-rotation/encryption_rotation.go, test/e2e-encryption-rotation/e2e-encryption-rotation_test.go
Adds an encryption rotation test implementation and replaces heavy inlined setup in the public test with a delegate call to a wrapper helper.
External OIDC
test/e2e-oidc/external_oidc.go, test/e2e-oidc/external_oidc_test.go
Adds a large external OIDC integration test (Keycloak flows, JWKS/JWT verification, auth-config and KAS rollouts) and reduces the exported test to delegate to an internal helper.
Test library wrappers & waits
test/library/encryption_wrappers.go, test/library/waits.go
Adds testing.TB-compatible wrapper functions adapting library-go encryption tests and updates three wait helpers to accept testing.TB instead of *testing.T.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot requested review from ibihim and liouk February 9, 2026 07:48
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 9, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ropatil010
Once this PR has been reviewed and has the lgtm label, please assign liouk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@test/e2e-encryption/encryption.go`:
- Around line 30-40: The type assertion t.(*testing.T) in
testEncryptionTypeIdentity is unsafe for Ginkgo; change the API instead: update
the library function signature of library.TestEncryptionTypeIdentity to accept
testing.TB (not *testing.T) and adapt its implementation accordingly, then call
it directly as library.TestEncryptionTypeIdentity(t, library.BasicScenario{...})
from testEncryptionTypeIdentity; ensure all other callers of
TestEncryptionTypeIdentity are updated to pass testing.TB.

@ropatil010
Copy link
Contributor Author

ropatil010 commented Feb 9, 2026

/retitle CNTRLPLANE-2589: Migrate test/e2e-encryption to Ginkgo v2 framework

@openshift-ci openshift-ci bot changed the title Migrate test/e2e-encryption to Ginkgo v2 framework CNTRLPLANE-2589: Migrate test/e2e-encryption to Ginkgo v2 framework Feb 9, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 9, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 9, 2026

@ropatil010: This pull request references CNTRLPLANE-2589 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Hi Team,

Changes:

  1. File Structure (matching test/e2e pattern):
  • Created encryption.go - Ginkgo test implementation with g.Describe/g.It
  • Modified encryption_test.go - Traditional test wrappers for backward compatibility
  • Removed main_test.go - No longer needed (Ginkgo has built-in randomization)
  1. Test Implementation:
  • Wrapped tests in g.Describe("[sig-auth] authentication operator", ...)
  • Tagged with [Encryption][Serial] (matches Makefile -p 1 -parallel 1 config)
  • Tests use testXxx(testing.TB) functions for shared logic
  • Traditional TestXxx(t *testing.T) wrappers call testXxx(t)
  1. OTE Integration:
  • Added import for test/e2e-encryption package
  • Created encryption/serial suite with parallelism=1
  • Tests discoverable via openshift-tests-extension binary

Test Configuration (from Makefile line 59-66):

  • Marked as serial: "extremely slow serial e2e encryption tests"
  • Run with: -p 1 -parallel 1 -timeout 4h
  • Modify cluster global state (require serial execution)

Tests Migrated:

  • TestEncryptionTypeIdentity
  • TestEncryptionTypeUnset
  • TestEncryptionTurnOnAndOff

Verified:

  • go build ./test/e2e-encryption/... ✓
  • All 3 tests discovered by OTE ✓
  • Suite configured with parallelism=1 ✓

Need to remove the fail cmd/**/main.go file once hte PR: #833 gets merged.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@test/e2e-encryption-perf/encryption_perf.go`:
- Around line 29-79: The test currently casts tt.(*testing.T) in
testPerfEncryptionTypeAESCBC which panics under Ginkgo's *GinkgoTBWrapper;
update the call to library.TestPerfEncryption to pass tt as a testing.TB (i.e.,
call library.TestPerfEncryption(tt, ...)) and change the library-go helper
signature from func TestPerfEncryption(t *testing.T, ...) to func
TestPerfEncryption(t testing.TB, ...), removing any internal *testing.T type
assertions; update any other callers of TestPerfEncryption to accept testing.TB
accordingly.

In `@test/e2e-encryption-rotation/encryption_rotation.go`:
- Line 31: Change the TestEncryptionRotation API to accept the testing.TB
interface instead of forcing a *testing.T cast: update the library function
signature of TestEncryptionRotation to take parameter type testing.TB (e.g.,
func TestEncryptionRotation(t testing.TB, ...)) and adjust its internal uses to
only call methods available on testing.TB (or accept a helper wrapper when
*testing.T-specific behavior is required); then remove the unsafe cast in
encryption_rotation.go and pass t (from g.GinkgoTB() or normal *testing.T)
directly to library.TestEncryptionRotation. Ensure any call sites and helper
functions (TestEncryptionRotation and callers) are updated to compile against
testing.TB.

In `@test/e2e-oidc/external_oidc.go`:
- Around line 311-320: The poll callback is checking the wrong error variable
and the require messages use the stale `err`; update the anonymous func passed
to wait.PollUntilContextTimeout to check `if cmErr != nil { return false, nil }`
after calling testClient.kubeClient.CoreV1().ConfigMaps(...).Get(...), and
update the require.NoError assertions to reference `cmErr` for the Get error and
`waitErr` for the wait error (use their respective variables in the format
strings). This affects the function using wait.PollUntilContextTimeout, the
local variables `cmPtr`/`cmErr`, and the require.NoError calls that currently
interpolate `err`.
- Line 94: Change the WaitForNewKASRollout and
WaitForClusterOperatorStatusAlwaysAvailable functions in test/library/waits.go
to accept testing.TB instead of *testing.T (update their signatures and any
internal param names), and update all callers (e.g., in
test/e2e-oidc/external_oidc.go) to pass t directly without type-asserting
t.(*testing.T); remove the casts at the calls that reference
WaitForNewKASRollout and WaitForClusterOperatorStatusAlwaysAvailable and ensure
any other callers across the repo are updated to use testing.TB-compatible
calls.
🧹 Nitpick comments (1)
test/e2e-oidc/external_oidc.go (1)

463-467: Minor: Unreachable return after t.Fatalf.

The return statement on line 467 is unreachable since t.Fatalf will terminate the test. This is harmless but could be cleaned up.

♻️ Optional cleanup
 	if len(featureGates.Status.FeatureGates) != 1 {
 		// fail test if there are multiple feature gate versions (i.e. ongoing upgrade)
 		t.Fatalf("multiple feature gate versions detected")
-		return
 	}

@ropatil010 ropatil010 force-pushed the migrate-e2e-encryption branch from da9db09 to c1df3a7 Compare February 9, 2026 11:53
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@test/e2e-oidc/external_oidc.go`:
- Around line 1073-1087: In authResourceRollback, avoid nil dereference by
capturing the authentication name (e.g., authName := "cluster" or a variable
holding the resource name used) before calling
tc.configClient.ConfigV1().Authentications().Get, then use that authName in both
error messages instead of auth.Name; after a successful Get you can still use
the returned auth for updates, but do not reference auth when the Get returned
an error.
- Around line 379-426: In fetchIssuerJWKS, set a finite timeout on the
http.Client and enforce a TLS minimum version to avoid hung tests and weak TLS;
update the client construction (in fetchIssuerJWKS) to include e.g. Timeout:
10*time.Second and in the Transport's TLSClientConfig set MinVersion:
tls.VersionTLS12 (keep InsecureSkipVerify as before if required), so the HTTP
calls time out and TLS is at least 1.2.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@test/e2e-oidc/external_oidc.go`:
- Around line 63-66: Update the Ginkgo test label for the test defined in the
g.Describe block so it runs serially: change the test declaration
g.It("[OIDC][Parallel] TestExternalOIDCWithKeycloak", ...) to use "[Serial]"
instead of "[Parallel]" (i.e., g.It("[OIDC][Serial]
TestExternalOIDCWithKeycloak", func() {
testExternalOIDCWithKeycloak(g.GinkgoTB()) })). Ensure only the label text is
changed and the call to testExternalOIDCWithKeycloak remains unchanged.

This commit migrates the e2e test suites for encryption, encryption-rotation,
encryption-perf, and OIDC tests from Ginkgo v1 to v2 framework. The migration
includes:

- Update test suite initialization to use Ginkgo v2 syntax
- Replace deprecated test main functions with proper suite setup
- Extract test logic into separate package files for better organization
- Fix type assertions and error handling in e2e tests
- Add HTTP client safety measures and nil pointer checks
- Fix gofmt formatting issues
- Update test suite definitions to match CI job configuration
- Add encryption wrapper utilities for common test operations

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
@ropatil010 ropatil010 force-pushed the migrate-e2e-encryption branch from c8214a4 to 9f9321b Compare February 10, 2026 12:22
@ropatil010
Copy link
Contributor Author

/retest

)

var _ = g.Describe("[sig-auth] authentication operator", func() {
g.It("[OIDC][Parallel] TestExternalOIDCWithKeycloak", func() {
Copy link
Member

Choose a reason for hiding this comment

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

The external OIDC tests shouldn't be run in parallel; they're Serial and also Disruptive, as they're rolling out new kube-apiserver pods. See also: https://github.com/openshift/origin/blob/main/test/extended/authentication/oidc.go#L41

Given the OTE integration, we're planning on merging the e2e tests that currently exist in this repo with the ones in origin, as they have a large overlap.

The TestExternalOIDCWithKeycloak test modifies cluster-wide authentication
configuration, which can disrupt cluster operations and interfere with other
tests running in parallel. This change:

- Updates test tag from [Parallel] to [Serial][Disruptive]
- Adds new oidc/serial-disruptive suite with ClusterStability: Disruptive
- Sets 120-minute timeout for disruptive operations

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 11, 2026

@ropatil010: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-operator-parallel-ote 7bccd3f link false /test e2e-aws-operator-parallel-ote
ci/prow/e2e-agnostic 7bccd3f link true /test e2e-agnostic
ci/prow/e2e-aws-operator-serial-ote 7bccd3f link false /test e2e-aws-operator-serial-ote
ci/prow/e2e-gcp-operator-encryption-kms 7bccd3f link false /test e2e-gcp-operator-encryption-kms

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants