Skip to content

encryption: accept testing.TB instead of *testing.T in test helpers#2159

Open
gangwgr wants to merge 1 commit intoopenshift:masterfrom
gangwgr:encryption-testing-tb
Open

encryption: accept testing.TB instead of *testing.T in test helpers#2159
gangwgr wants to merge 1 commit intoopenshift:masterfrom
gangwgr:encryption-testing-tb

Conversation

@gangwgr
Copy link
Copy Markdown
Contributor

@gangwgr gangwgr commented Apr 10, 2026

The encryption test helper functions (TestEncryptionTypeAESCBC, NewE, etc.) currently require *testing.T, which prevents them from being used with Ginkgo's GinkgoTB() in OTE (OpenShift Tests Extension) migrations.

Change the function signatures to accept testing.TB (the interface that both *testing.T and GinkgoTBWrapper satisfy) so consumers can call these helpers from both standard Go tests and Ginkgo specs.

Functions that use t.Run() (TestEncryptionTurnOnAndOff, TestEncryptionProvidersMigration) are left as *testing.T since Run() is not part of the testing.TB interface.

This is backward compatible: existing callers passing *testing.T continue to work without changes.

The encryption test helper functions (TestEncryptionTypeAESCBC, NewE, etc.)
currently require *testing.T, which prevents them from being used with
Ginkgo's GinkgoTB() in OTE (OpenShift Tests Extension) migrations.

Change the function signatures to accept testing.TB (the interface that
both *testing.T and GinkgoTBWrapper satisfy) so consumers can call these
helpers from both standard Go tests and Ginkgo specs.

Functions that use t.Run() (TestEncryptionTurnOnAndOff,
TestEncryptionProvidersMigration) are left as *testing.T since
Run() is not part of the testing.TB interface.

This is backward compatible: existing callers passing *testing.T
continue to work without changes.

Made-with: Cursor
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 10, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 242e7813-175b-4920-b6c6-5b1a34af30eb

📥 Commits

Reviewing files that changed from the base of the PR and between c57da2b and 9bfdde3.

📒 Files selected for processing (2)
  • test/library/encryption/e_log.go
  • test/library/encryption/scenarios.go

Walkthrough

The changes replace concrete *testing.T type parameters and fields with the testing.TB interface in test helper functions and a custom logging struct, maintaining existing functionality while increasing type flexibility.

Changes

Cohort / File(s) Summary
Testing interface refactoring
test/library/encryption/e_log.go, test/library/encryption/scenarios.go
Updated E struct and seven test helper functions (TestEncryptionTypeIdentity, TestEncryptionTypeUnset, TestEncryptionTypeAESCBC, TestEncryptionTypeAESGCM, TestEncryptionTypeKMS, TestEncryptionType, TestEncryptionRotation) to accept testing.TB interface instead of *testing.T pointer type. Adjusted logging and error reporting calls accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@gangwgr gangwgr marked this pull request as ready for review April 10, 2026 16:25
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 10, 2026
@openshift-ci openshift-ci bot requested review from dgrisonnet and p0lyn0mial April 10, 2026 16:25
@ardaguclu
Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 10, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ardaguclu, gangwgr
Once this PR has been reviewed and has the lgtm label, please assign dgrisonnet 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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 10, 2026

@gangwgr: all tests passed!

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.

@p0lyn0mial
Copy link
Copy Markdown
Contributor

could you open a pr in kas-o to ensure that the tests still work ?

@gangwgr
Copy link
Copy Markdown
Contributor Author

gangwgr commented Apr 14, 2026

could you open a pr in kas-o to ensure that the tests still work ?
openshift/cluster-kube-apiserver-operator#2100 drafted
it works, rebase again to test again

@gangwgr
Copy link
Copy Markdown
Contributor Author

gangwgr commented Apr 16, 2026

could you open a pr in kas-o to ensure that the tests still work ?
openshift/cluster-kube-apiserver-operator#2100 drafted
it works, rebase again to test again

@p0lyn0mial it is working fine our case are passing only monitor cases are failing

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

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants