Skip to content

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

Open
ropatil010 wants to merge 7 commits intoopenshift:masterfrom
ropatil010:migrate-e2e-encryption
Open

CNTRLPLANE-2589: Migrate test/e2e-encryption to Ginkgo v2 framework#839
ropatil010 wants to merge 7 commits intoopenshift:masterfrom
ropatil010:migrate-e2e-encryption

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

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
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.

@ropatil010
Copy link
Contributor Author

ropatil010 commented Feb 13, 2026

/test e2e-aws-operator-encryption-serial-ote-1of2
/test e2e-aws-operator-encryption-serial-ote-2of2
/test e2e-aws-operator-encryption-perf-serial-ote-1of2
/test e2e-aws-operator-encryption-perf-serial-ote-2of2
/test e2e-aws-operator-encryption-rotation-serial-ote-1of2
/test e2e-aws-operator-encryption-rotation-serial-ote-2of2
/test e2e-aws-operator-serial-ote e2e
/test e2e-aws-operator-encryption-serial-ote
/test e2e-aws-operator-encryption-perf-serial-ote
/test e2e-gcp-operator-encryption-kms
/test e2e-agnostic

@gangwgr
Copy link
Contributor

gangwgr commented Feb 16, 2026

/pipeline required

@ropatil010 ropatil010 force-pushed the migrate-e2e-encryption branch 2 times, most recently from e511745 to 4ce4710 Compare February 26, 2026 14:55
@ropatil010
Copy link
Contributor Author

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 26, 2026
@ropatil010
Copy link
Contributor Author

/test e2e-aws-operator-serial-ote

@ropatil010
Copy link
Contributor Author

/test e2e-operator

@ropatil010
Copy link
Contributor Author

/test e2e-aws-operator-serial-ote

@ropatil010 ropatil010 force-pushed the migrate-e2e-encryption branch from e855094 to c11012c Compare March 2, 2026 11:50
This commit migrates encryption-related and OIDC e2e test suites to the
Ginkgo v2 framework and fixes critical OIDC test failures observed in CI.

## Ginkgo v2 Migration

### Encryption Tests
- Migrate encryption, encryption-rotation, encryption-perf e2e tests to
  Ginkgo v2 framework with updated test initialization syntax
- Extract test logic into separate files (encryption.go, encryption_rotation.go,
  encryption_perf.go) for better organization and reusability
- Implement encryption test scenarios with testing.TB support for flexible
  test execution
- Refactor encryption wrappers to use local implementations
- Add timeout tags to encryption e2e tests for better test management
- Remove obsolete main_test.go files

### OIDC Tests
- Migrate OIDC e2e tests to Ginkgo v2 framework
- Extract TestExternalOIDCWithKeycloak implementation to external_oidc.go
- Convert OIDC e2e tests to Serial and Disruptive execution model

### Test Infrastructure
- Configure test suites in the OTE test registry with appropriate parallelism
  and timeout settings for encryption tests
- Add helper modules in test/library/encryption/ for test scenarios and
  performance helpers
- Remove unused oidc/serial-disruptive suite that was never invoked by any
  Prow job (OIDC tests run via operator/serial suite or direct go test)
- Remove unused time package import from main.go

## OIDC Test Failure Fixes

### Root Cause
TestExternalOIDCWithKeycloak was timing out after 1 hour while executing
subtests that each wait for authentication and kube-apiserver operators to
remain stable for 10 continuous minutes. In CI environments with resource
contention, the test legitimately takes ~3 hours to complete all subtests.
When it timed out, cleanup didn't complete properly, leaving the cluster
in a degraded state. Subsequent OIDC tests (TestGitLabAsOIDCPasswordGrantCheck,
TestKeycloakAsOIDCPasswordGrantCheckAndGroupSync) inherited this degraded
cluster and failed with 'authentication operator never became progressing' errors.

### Fixes Applied

1. **Increase TestExternalOIDCWithKeycloak timeout from 1h to 3h**
   Based on e2e-oidc Prow logs (build 2027354543884341248), the test
   completes successfully in approximately 3 hours when given enough time.
   The test has multiple subtests, each waiting 10 minutes for operator
   stability, which is legitimate test behavior for disruptive tests.

2. **Add cluster recovery step in test cleanup**
   After cleanup runs (whether test passes, fails, or times out), we now
   wait for both authentication and kube-apiserver operators to become
   Available/NotProgressing/NotDegraded before exiting. This ensures:
   - Subsequent tests start on a healthy cluster
   - No cascade of failures from inherited degraded state
   - Uses WaitForClusterOperatorAvailableNotProgressingNotDegraded (max 10min)
     instead of the stricter WaitForClusterOperatorStatusAlwaysAvailable
   - Logs warnings but doesn't fail if recovery times out

### Expected Impact
- TestExternalOIDCWithKeycloak will complete successfully in CI
- Even if it times out, cluster will recover before next test
- TestGitLabAsOIDCPasswordGrantCheck will pass on clean cluster
- TestKeycloakAsOIDCPasswordGrantCheckAndGroupSync will pass on clean cluster

## Testing
- All encryption tests verified with refactored structure
- All three OIDC tests pass on live cluster (4.22.0-nightly)
- Cluster recovery validated on timeout scenarios
- Unit tests pass: make test-unit
- Build successful: make build
- Verification passed: make verify

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
@ropatil010 ropatil010 force-pushed the migrate-e2e-encryption branch from bb4951c to ac1c999 Compare March 2, 2026 12:00
@ropatil010
Copy link
Contributor Author

CI Jobs results wrt cluster auth operator:

1. e2e-aws-operator-encryption-kms-serial-ote-1of2
2. e2e-aws-operator-encryption-kms-serial-ote-2of2
  CI job failure reason: error: error running a test suite: no tests to run

3. e2e-aws-operator-encryption-serial-ote-1of2
  passed: (5m1s) 2026-03-02T13:15:42 "[sig-auth] authentication operator [Encryption][Serial] TestEncryptionTypeUnset"   
4. e2e-aws-operator-encryption-serial-ote-2of2
  passed: (30m20s) 2026-03-02T13:45:19 "[sig-auth] authentication operator [Encryption][Serial] TestEncryptionTurnOnAndOff [Timeout:3h]"
  passed: (5m1s) 2026-03-02T13:50:20 "[sig-auth] authentication operator [Encryption][Serial] TestEncryptionTypeIdentity"
  CI job failure reason: error: error running a test suite: failed due to a MonitorTest failure
   
5. e2e-aws-operator-parallel-ote
  CI job failure reason: Suite run returned error: failed due to a MonitorTest failure

6. e2e-aws-operator-serial-ote
  passed: (2h18m49s) 2026-03-02T15:36:00 "[sig-auth] authentication operator [OIDC][Serial][Disruptive] TestExternalOIDCWithKeycloak [Timeout:3h]"
  passed: (3m54s) 2026-03-02T15:39:54 "[sig-auth] authentication operator [OIDC][Serial] TestGitLabAsOIDCPasswordGrantCheck"
  passed: (2m30s) 2026-03-02T15:42:25 "[sig-auth] authentication operator [OIDC][Serial] TestKeycloakAsOIDCPasswordGrantCheckAndGroupSync"
  CI job failure reason: Failed during execution of monitor related cases 

7. e2e-aws-operator-encryption-perf-serial-ote-1of2
  passed: (14m6s) 2026-03-02T13:27:01 "[sig-auth] authentication operator [Encryption][Serial] TestPerfEncryptionTypeAESCBC"
8. e2e-aws-operator-encryption-perf-serial-ote-2of2
  No tests wrt cluster authentication operator

9. e2e-aws-operator-encryption-rotation-serial-ote-1of2 
  passed: (15m7s) 2026-03-02T13:26:53 "[sig-auth] authentication operator [Encryption][Serial] TestEncryptionRotation [Timeout:3h]"
10. e2e-aws-operator-encryption-rotation-serial-ote-2of2 
  No tests wrt cluster authentication operator

Hi @liouk, can you plz help to review this PR.

})

func testExternalOIDCWithKeycloak(t testing.TB) {
testCtx := context.Background()
Copy link
Member

Choose a reason for hiding this comment

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

Can we use t.Context() instead?

Suggested change
testCtx := context.Background()
testCtx := t.Context()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried with the suggestion but hit error as mentioned in my 3rd commit

GinkgoTB() doesn't implement Context() method (added in Go 1.21). Calling t.Context() returns nil, causing a nil pointer dereference. Replace with context.Background() to match Ginkgo v2 patterns.
Issue: - "runtime error: invalid memory address or nil pointer dereference"

}

// Test: auth-config cm must not exist and gets deleted by the CAO if manually created when type not OIDC
t.Logf("auth-config cm must not exist and gets deleted by the CAO if manually created when type not OIDC")
Copy link
Member

Choose a reason for hiding this comment

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

I've noticed that we're now using t.Logf() for sub-tests; this means individual sub-test failures won't be reported separately in Ginkgo - the entire test is a single g.It(). Is there a way to preserve the sub-tests as separate, while still being compatible with Ginkgo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. The shared Keycloak setup is too expensive to duplicate
  2. Some tests explicitly depend on previous test state (Test 5 needs Test 4), Would need complex BeforeEach logic to set up different states
  3. Cluster rollout times make per-test cleanup prohibitively slow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried with the suggestions but hit error as mentioned in 3rd commit.
g.By() can only be called within a Ginkgo spec context (inside g.It(), BeforeEach(), etc.). When test logic is extracted to a separate function called via g.GinkgoTB(), the Ginkgo context is lost and g.By() fails with "calling By outside of a running spec". Replace all g.By() calls with t.Logf() for proper logging.

Issue: "Ginkgo detected an issue with your spec structure"

- Use t.Context() instead of context.Background() for better test lifecycle integration
- Replace t.Logf() with g.By() for improved test step visibility in Ginkgo reports
- Remove unused oidcAuthResponse struct

These changes address PR review feedback to improve test context management
and sub-test reporting while maintaining the current test structure.

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

/test e2e-oidc-techpreview

@ropatil010
Copy link
Contributor Author

/test e2e-console-login
/test e2e-gcp-operator-encryption-kms
/test e2e-oidc
/test e2e-oidc-techpreview
/test e2e-operator-encryption
/test e2e-aws-operator-serial-ote

Rohit Patil and others added 5 commits March 5, 2026 12:38
Fixes two critical bugs introduced during the Ginkgo v2 migration:

1. GinkgoTB() doesn't implement Context() method (added in Go 1.21).
   Calling t.Context() returns nil, causing a nil pointer dereference.
   Replace with context.Background() to match Ginkgo v2 patterns.

2. g.By() can only be called within a Ginkgo spec context (inside
   g.It(), BeforeEach(), etc.). When test logic is extracted to a
   separate function called via g.GinkgoTB(), the Ginkgo context is
   lost and g.By() fails with "calling By outside of a running spec".
   Replace all g.By() calls with t.Logf() for proper logging.

These issues caused CI failures with:
- "runtime error: invalid memory address or nil pointer dereference"
- "Ginkgo detected an issue with your spec structure"

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
Completes the Ginkgo v2 migration by converting the KMS encryption tests
to use Ginkgo specs while maintaining backward compatibility with traditional
go test execution.

## Changes

### Test Structure Migration
- Create encryption_kms.go with Ginkgo v2 specs using g.Describe/g.It
- Convert encryption_kms_test.go to thin wrapper functions for go test
- Remove main_test.go (test randomization now handled by Ginkgo)
- Add [Encryption][Serial] tags for proper suite classification
- Add [Timeout:2h] tags for long-running KMS tests

### Testing.TB Support
- Add TestEncryptionProvidersMigration() to test/library/encryption/scenarios.go
  that accepts testing.TB instead of *testing.T for Ginkgo compatibility
- Add wrapper function in test/library/encryption_wrappers.go
- Fix go vet warnings by using proper format strings in tb.Logf calls

### OTE Integration
- Enable e2e-encryption-kms import in cmd/cluster-authentication-operator-tests-ext/main.go
- Tests are now discoverable by OpenShift Tests Extension framework
- Will run in operator-encryption-kms/serial suite with parallelism=1

## Dual Execution Support

The tests now work with both execution methods:

1. **Traditional go test**: `make test-e2e-encryption-kms`
   - Uses wrapper functions in encryption_kms_test.go
   - Maintains backward compatibility

2. **Ginkgo/OTE**: `./cluster-authentication-operator-tests-ext`
   - Uses specs in encryption_kms.go
   - Integrated with OpenShift CI framework

## Verification

- ✅ Both test methods compile and discover tests correctly
- ✅ All unit tests pass (make test-unit)
- ✅ Code formatting verified (make verify-gofmt)
- ✅ Static analysis clean (make verify-govet)
- ✅ Binaries build successfully (make build)
- ✅ OTE discovers both KMS tests with correct tags

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
The e2e-encryption-kms tests were failing with "Unknown encryption type: KMS"
because the Ginkgo v2 migration in commit f3eb497 created local implementations
of encryption test functions but forgot to add KMS encryption type support.

## Issue
When migrating to Ginkgo v2, local implementations of encryption test functions
were created in test/library/encryption/scenarios.go to support testing.TB
(needed for Ginkgo's GinkgoTB()). However, while the upstream library-go has
TestEncryptionTypeKMS, the local implementation was missing:
- TestEncryptionTypeKMS() function
- Case for configv1.EncryptionTypeKMS in TestEncryptionType() switch

This caused tests to fail with:
  scenarios.go:75: Unknown encryption type: KMS

## Fix
Add TestEncryptionTypeKMS() function and KMS case to the switch statement,
following the same pattern as AESCBC and AESGCM implementations.

## Testing
- All unit tests pass (make test-unit)
- All verification checks pass (make verify)
- Binaries build successfully (make build)
- e2e-encryption-kms tests compile successfully
- Verified the fix allows tests to progress beyond the encryption type check

Tests now fail at cluster validation level (expected - requires KMSEncryption
feature gate enabled on the test cluster).

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
Extract duplicate checkFeatureGatesOrSkip function to shared library,
add proper feature gate checking before conditional skips in KMS tests,
and fix race condition in OIDC authResourceRollback using retry logic.

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
Remove unused imports that were leftover from extracting
checkFeatureGatesOrSkip to shared library.

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

/test e2e-oidc

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 10, 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-encryption-perf-serial-ote-1of2 5eac65a link false /test e2e-aws-operator-encryption-perf-serial-ote-1of2
ci/prow/e2e-aws-operator-serial-ote 5eac65a link false /test e2e-aws-operator-serial-ote
ci/prow/e2e-gcp-operator-disruptive 5eac65a link true /test e2e-gcp-operator-disruptive
ci/prow/e2e-aws-operator-encryption-serial-ote-2of2 5eac65a link false /test e2e-aws-operator-encryption-serial-ote-2of2
ci/prow/e2e-aws-operator-encryption-kms-serial-ote-2of2 5eac65a link false /test e2e-aws-operator-encryption-kms-serial-ote-2of2
ci/prow/e2e-aws-operator-encryption-perf-serial-ote-2of2 5eac65a link false /test e2e-aws-operator-encryption-perf-serial-ote-2of2
ci/prow/e2e-aws-operator-encryption-kms-serial-ote-1of2 5eac65a link false /test e2e-aws-operator-encryption-kms-serial-ote-1of2
ci/prow/e2e-aws-operator-parallel-ote 5eac65a link false /test e2e-aws-operator-parallel-ote

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

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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.

4 participants