Skip to content

CNTRLPLANE-2589: test/library/encryption: Accept testing.TB for OTE compatibility#2335

Open
ropatil010 wants to merge 1 commit into
openshift:masterfrom
ropatil010:interface-ginkgo
Open

CNTRLPLANE-2589: test/library/encryption: Accept testing.TB for OTE compatibility#2335
ropatil010 wants to merge 1 commit into
openshift:masterfrom
ropatil010:interface-ginkgo

Conversation

@ropatil010

@ropatil010 ropatil010 commented Jun 26, 2026

Copy link
Copy Markdown

Change TestPerfEncryption and runTestEncryption to accept testing.TB interface instead of *testing.T concrete type. This enables these functions to be used with both standard Go tests and Ginkgo/OTE framework tests.

The testing.TB interface is implemented by both *testing.T and *testing.B, as well as Ginkgo's GinkgoTB. This change is 100% backwards compatible - all existing callers passing *testing.T will continue to work.

This eliminates the need for downstream operators to duplicate these functions when migrating to the OpenShift Tests Extension (OTE) framework. Currently, operators must copy ~400+ lines of code from library-go just to change *testing.T to testing.TB.

Benefits:

  • Enables OTE framework migration across OpenShift operators
  • Reduces code duplication in downstream repos
  • Maintains full backwards compatibility
  • No behavior changes, only signature widening

Related: openshift/cluster-authentication-operator#926
Discussion: https://redhat-internal.slack.com/archives/C07RDCVEYJG/p1782475409270789

For PR: openshift/cluster-authentication-operator#859 the changes are already present in this repo.

  test/library/encryption/scenarios.go:
    1. ✅ TestEncryptionTypeIdentity - Line 36 (testing.TB)
    2. ✅ TestEncryptionTypeUnset - Line 42 (testing.TB)
    3. ✅ TestEncryptionTypeAESCBC - Line 59 (testing.TB)
    4. ✅ TestEncryptionTypeAESGCM - Line 67 (testing.TB)
    5. ✅ TestEncryptionTypeKMS - Line 75 (testing.TB)
    6. ✅ TestEncryptionType - Line 83 (testing.TB)
    7. ✅ TestEncryptionTurnOnAndOff - Line 113 (testing.TB)
    8. ✅ TestEncryptionProvidersMigration - Line 184 (testing.TB)
    9. ✅ TestEncryptionRotation - Line 249 (testing.TB)
    10. ✅ TestKMSInvalidEncryptionRecovery - Line 309 (testing.TB)

  test/library/encryption/perf_helpers.go:
    11. ✅ watchForMigrationControllerProgressingConditionAsync - Line 17 (testing.TB)
    12. ✅ watchForMigrationControllerProgressingCondition - Line 22 (testing.TB)
    13. ✅ populateDatabase - Line 45 (testing.TB)
    14. ✅ runner.run - Line 85 (testing.TB)

Summary by CodeRabbit

  • Tests
    • Improved test compatibility by aligning test helper interfaces with standard testing types.
    • No user-facing behavior changed.

Change TestPerfEncryption and runTestEncryption to accept testing.TB
interface instead of *testing.T concrete type. This enables these
functions to be used with both standard Go tests and Ginkgo/OTE
framework tests.

The testing.TB interface is implemented by both *testing.T and
*testing.B, as well as Ginkgo's GinkgoTB. This change is 100%
backwards compatible - all existing callers passing *testing.T
will continue to work.

This eliminates the need for downstream operators to duplicate
these functions when migrating to the OpenShift Tests Extension
(OTE) framework. Currently, operators must copy ~400+ lines of
code from library-go just to change *testing.T to testing.TB.

Benefits:
- Enables OTE framework migration across OpenShift operators
- Reduces code duplication in downstream repos
- Maintains full backwards compatibility
- No behavior changes, only signature widening

Related: openshift/cluster-authentication-operator#926

Co-Authored-By: Rohit Patil <ropatil@redhat.com>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 26, 2026
@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 Jun 26, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 26, 2026

Copy link
Copy Markdown

@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 "5.0.0" version, but no target version was set.

Details

In response to this:

Change TestPerfEncryption and runTestEncryption to accept testing.TB interface instead of *testing.T concrete type. This enables these functions to be used with both standard Go tests and Ginkgo/OTE framework tests.

The testing.TB interface is implemented by both *testing.T and *testing.B, as well as Ginkgo's GinkgoTB. This change is 100% backwards compatible - all existing callers passing *testing.T will continue to work.

This eliminates the need for downstream operators to duplicate these functions when migrating to the OpenShift Tests Extension (OTE) framework. Currently, operators must copy ~400+ lines of code from library-go just to change *testing.T to testing.TB.

Benefits:

  • Enables OTE framework migration across OpenShift operators
  • Reduces code duplication in downstream repos
  • Maintains full backwards compatibility
  • No behavior changes, only signature widening

Related: openshift/cluster-authentication-operator#926
Discussion: https://redhat-internal.slack.com/archives/C07RDCVEYJG/p1782475409270789

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.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Walkthrough

TestPerfEncryption and runTestEncryption now accept testing.TB instead of *testing.T, while the encryption performance test logic stays unchanged.

Changes

Encryption performance test helpers

Layer / File(s) Summary
Test handle signature updates
test/library/encryption/perf_scenarios.go
TestPerfEncryption and runTestEncryption now use testing.TB in their signatures, with no change to the existing scenario flow.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR only widens function signatures in perf_scenarios.go; no Ginkgo It/Describe/Context/When titles were added or changed, so no unstable test names.
Test Structure And Quality ✅ Passed PASS: The PR only widens helper signatures to testing.TB; no Ginkgo It blocks, setup/cleanup, waits, or assertions were added or altered.
Microshift Test Compatibility ✅ Passed The PR only widens helper signatures in a non-Ginkgo library file; no new It/Describe/Context/When tests or MicroShift-unsafe APIs were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Touched file only widens helper signatures to testing.TB; it adds no It/Describe/Context tests or SNO-sensitive assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only test helper signatures in test/library/encryption/perf_scenarios.go changed; no manifests, controllers, or scheduling constraints were added.
Ote Binary Stdout Contract ✅ Passed Only signature widening in perf_scenarios.go; no main/init/TestMain/BeforeSuite or stdout-writing calls were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only signature widening in an existing helper; no new Ginkgo tests, IPv4 assumptions, or external connectivity were added.
No-Weak-Crypto ✅ Passed The PR only widens test signatures to testing.TB; the touched package contains no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or secret/token comparisons.
Container-Privileges ✅ Passed The PR only widens Go test signatures in perf_scenarios.go; no container/K8s manifests or privileged security settings were changed.
No-Sensitive-Data-In-Logs ✅ Passed Patch only widens test signatures; no new logs or sensitive data exposure were introduced.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: switching encryption test helpers to testing.TB for OTE compatibility.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from ardaguclu and p0lyn0mial June 26, 2026 12:40
@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@ropatil010: 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.

@ropatil010 ropatil010 changed the title [WIP] CNTRLPLANE-2589: test/library/encryption: Accept testing.TB for OTE compatibility CNTRLPLANE-2589: test/library/encryption: Accept testing.TB for OTE compatibility Jun 26, 2026
@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 Jun 26, 2026
@ropatil010

Copy link
Copy Markdown
Author

/assign @liouk @stbenjam
PTAL.

@ropatil010

Copy link
Copy Markdown
Author

/assign @p0lyn0mial @bertinatto
PTAL on the PR when ever get a chance.

@stbenjam

Copy link
Copy Markdown
Member

/lgtm

You'll need someone from OWNERS to approve, but this lgtm. *T implements TB.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 29, 2026
@openshift-ci

openshift-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ropatil010, stbenjam
Once this PR has been reviewed and has the lgtm label, please ask for approval from bertinatto. 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

@ropatil010

Copy link
Copy Markdown
Author

/assign @deads2k

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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants