Skip to content

Conversation

@wangke19
Copy link
Contributor

@wangke19 wangke19 commented Dec 23, 2025

Summary

Migrate the tokenreviews e2e test to OpenShift Tests Extension (OTE) framework while keeping the original test unchanged.

⚠️ IMPORTANT: This PR depends on #162 and should be merged after it.

This PR contains exactly 2 commits following the required structure:

Commit Structure

Commit 1: Infrastructure code changes only

Commit: test/e2e: add OTE test wrapper for tokenreviews

Changes:

  • Add test/e2e/oauth_token.go with Ginkgo test wrapper
  • Update cmd/oauth-apiserver-tests-ext/main.go to register Ginkgo tests
    • Import test package: _ "github.com/openshift/oauth-apiserver/test/e2e"
    • Import OTE ginkgo: oteginkgo "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
    • Call oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
    • Use extension.AddSpecs(testSpecs) to add test specs

Files changed: 2 files

  • cmd/oauth-apiserver-tests-ext/main.go (modified)
  • test/e2e/oauth_token.go (new)

Commit 2: Dependency updates

Commit: go.mod, vendor: add Ginkgo and OTE dependencies

Changes:

  • Add github.com/onsi/ginkgo/v2 v2.24.0 to go.mod (with replace directive to OpenShift fork)
  • Update go.sum with checksums
  • Vendor all dependencies (257 new files)

Files changed: 259 files

  • go.mod (modified)
  • go.sum (modified)
  • vendor/ (257 new files)

Test Structure

var _ = g.Describe("[sig-auth] OAuth", func() {
    g.It("should successfully review valid and invalid tokens [apigroup:oauth.openshift.io]", func(ctx context.Context) {
        testTokenReviewsGinkgo(g.GinkgoTB())
    })
})

Implementation Details

oauth_token.go

  • Ginkgo wrapper that calls testTokenReviewsGinkgo()
  • Uses testing.TB interface for dual compatibility
  • Type asserts to *testing.T when calling existing helper functions
  • Reuses all existing test logic from tokenreviews.go

main.go updates

  • Imports test package to trigger Ginkgo test registration
  • Calls oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() to build test specs
  • Adds specs to extension using extension.AddSpecs(testSpecs)

Unchanged Files

  • test/e2e/tokenreviews.go - Original test remains completely unchanged

OTE Discovery

After merging, the OTE binary will discover this test as:

[sig-auth] OAuth should successfully review valid and invalid tokens [apigroup:oauth.openshift.io]

Verification Commands

# Build OTE binary
make build

# Verify dependencies
make verify-deps

# List discovered tests
./oauth-apiserver-tests-ext list

# Run the test
./oauth-apiserver-tests-ext run-suite <suite-path> -c 1

Pattern Reference

  • Follows OpenShift OTE migration best practices
  • Two-commit structure: infrastructure first, dependencies second
  • No modifications to original test files
  • Uses testing.TB interface for compatibility

Dependencies

Related

@openshift-ci
Copy link

openshift-ci bot commented Dec 23, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

This commit introduces the OpenShift Tests Extension (OTE) framework
infrastructure for the OAuth API Server tests.

Changes:
- Refactor cmd/oauth-apiserver-tests-ext/main.go to use proper
  error handling pattern with error returns instead of direct exits
- Add prepareOperatorTestsRegistry with OTE extension configuration

The error handling pattern now follows Go best practices by returning
errors from functions and handling them in the caller, making the code
more testable and maintainable.

Note: Test package imports and oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
will be added in subsequent PRs when actual tests are migrated to the OTE framework.
@wangke19 wangke19 force-pushed the ote-migrate-tokenreviews-test branch from 807dc5a to 0a198b1 Compare December 23, 2025 13:16
@wangke19 wangke19 changed the title test/e2e: migrate tokenreviews test to OTE framework [WIP]test/e2e: migrate tokenreviews test to OTE framework Dec 23, 2025
@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 Dec 23, 2025
@wangke19 wangke19 changed the title [WIP]test/e2e: migrate tokenreviews test to OTE framework [WIP]CNTRLPLANE-2260:test/e2e: migrate tokenreviews test to OTE framework Dec 23, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Dec 23, 2025

@wangke19: This pull request references CNTRLPLANE-2260 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 task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Migrate the tokenreviews e2e test to OpenShift Tests Extension (OTE) framework while keeping the original test unchanged.

⚠️ IMPORTANT: This PR depends on #162 and should be merged after it.

Changes

New Files

  • test/e2e/oauth_token.go: Ginkgo wrapper for OTE framework
  • Contains testTokenReviewsGinkgo() function that delegates to original test helpers
  • Uses testing.TB interface for compatibility
  • Type asserts to *testing.T when calling existing helper functions
  • Properly structured with var _ = g.Describe() pattern for OTE discovery

Modified Files

  • cmd/oauth-apiserver-tests-ext/main.go:

  • Import test package: _ "github.com/openshift/oauth-apiserver/test/e2e"

  • Import OTE ginkgo: oteginkgo "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"

  • Call oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() to register tests

  • Use extension.AddSpecs(testSpecs) to add test specs to extension

  • go.mod:

  • Add github.com/onsi/ginkgo/v2 v2.24.0 (with replace directive to OpenShift fork)

  • Dependencies vendored

Unchanged Files

  • test/e2e/tokenreviews.go: ✅ Original test remains completely unchanged

Test Structure

var _ = g.Describe("[sig-auth] OAuth", func() {
   g.It("should successfully review valid and invalid tokens [apigroup:oauth.openshift.io]", func(ctx context.Context) {
       testTokenReviewsGinkgo(g.GinkgoTB())
   })
})

OTE Discovery

After merging, the OTE binary will discover this test as:

[sig-auth] OAuth should successfully review valid and invalid tokens [apigroup:oauth.openshift.io]

Verification Commands

# Build OTE binary
make build

# List discovered tests
./oauth-apiserver-tests-ext list

# Run the test
./oauth-apiserver-tests-ext run-suite <suite-path> -c 1

Migration Pattern

  • Follows OpenShift OTE migration best practices
  • Uses testing.TB interface for dual compatibility
  • No modifications to original test files
  • Type assertion used for compatibility with existing *testing.T helpers

Files Changed

  • test/e2e/oauth_token.go (new, 87 lines)
  • cmd/oauth-apiserver-tests-ext/main.go (modified)
  • go.mod (modified)
  • vendor/ (259 new files for Ginkgo and dependencies)

Commits

Single commit on top of PR #162:

  • test/e2e: migrate tokenreviews test to OTE framework

Dependencies

Related

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Dec 23, 2025
Add Ginkgo wrapper for the tokenreviews test to enable execution
through the OpenShift Tests Extension (OTE) framework.

Changes:
- Add test/e2e/oauth_token.go with Ginkgo test wrapper
- Update cmd/oauth-apiserver-tests-ext/main.go to register Ginkgo tests
  - Import test package and OTE ginkgo utilities
  - Call oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
  - Add test specs to extension with extension.AddSpecs()

The original TestTokenReviews function in tokenreviews.go remains
unchanged and can still be run with standard go test.
Add dependencies required for OTE test execution:
- github.com/onsi/ginkgo/v2 v2.24.0 (with replace to OpenShift fork)
- github.com/onsi/gomega v1.38.0
- Additional transitive dependencies for Ginkgo and OTE support

Updates:
- go.mod: Add Ginkgo dependency
- go.sum: Update checksums
- vendor/: Vendor all dependencies (257 new files)
@wangke19 wangke19 force-pushed the ote-migrate-tokenreviews-test branch from 0a198b1 to 044a5c7 Compare December 23, 2025 13:45
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Dec 23, 2025

@wangke19: This pull request references CNTRLPLANE-2260 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 task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Migrate the tokenreviews e2e test to OpenShift Tests Extension (OTE) framework while keeping the original test unchanged.

⚠️ IMPORTANT: This PR depends on #162 and should be merged after it.

This PR contains exactly 2 commits following the required structure:

Commit Structure

Commit 1: Infrastructure code changes only

Commit: test/e2e: add OTE test wrapper for tokenreviews

Changes:

  • Add test/e2e/oauth_token.go with Ginkgo test wrapper
  • Update cmd/oauth-apiserver-tests-ext/main.go to register Ginkgo tests
  • Import test package: _ "github.com/openshift/oauth-apiserver/test/e2e"
  • Import OTE ginkgo: oteginkgo "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
  • Call oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
  • Use extension.AddSpecs(testSpecs) to add test specs

Files changed: 2 files

  • cmd/oauth-apiserver-tests-ext/main.go (modified)
  • test/e2e/oauth_token.go (new)

Commit 2: Dependency updates

Commit: go.mod, vendor: add Ginkgo and OTE dependencies

Changes:

  • Add github.com/onsi/ginkgo/v2 v2.24.0 to go.mod (with replace directive to OpenShift fork)
  • Update go.sum with checksums
  • Vendor all dependencies (257 new files)

Files changed: 259 files

  • go.mod (modified)
  • go.sum (modified)
  • vendor/ (257 new files)

Test Structure

var _ = g.Describe("[sig-auth] OAuth", func() {
   g.It("should successfully review valid and invalid tokens [apigroup:oauth.openshift.io]", func(ctx context.Context) {
       testTokenReviewsGinkgo(g.GinkgoTB())
   })
})

Implementation Details

oauth_token.go

  • Ginkgo wrapper that calls testTokenReviewsGinkgo()
  • Uses testing.TB interface for dual compatibility
  • Type asserts to *testing.T when calling existing helper functions
  • Reuses all existing test logic from tokenreviews.go

main.go updates

  • Imports test package to trigger Ginkgo test registration
  • Calls oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() to build test specs
  • Adds specs to extension using extension.AddSpecs(testSpecs)

Unchanged Files

  • test/e2e/tokenreviews.go - Original test remains completely unchanged

OTE Discovery

After merging, the OTE binary will discover this test as:

[sig-auth] OAuth should successfully review valid and invalid tokens [apigroup:oauth.openshift.io]

Verification Commands

# Build OTE binary
make build

# Verify dependencies
make verify-deps

# List discovered tests
./oauth-apiserver-tests-ext list

# Run the test
./oauth-apiserver-tests-ext run-suite <suite-path> -c 1

Pattern Reference

  • Follows OpenShift OTE migration best practices
  • Two-commit structure: infrastructure first, dependencies second
  • No modifications to original test files
  • Uses testing.TB interface for compatibility

Dependencies

Related

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.

@openshift-ci
Copy link

openshift-ci bot commented Dec 23, 2025

@wangke19: 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-serial 044a5c7 link true /test e2e-aws-serial
ci/prow/e2e-aws 044a5c7 link true /test e2e-aws
ci/prow/okd-scos-images 044a5c7 link true /test okd-scos-images
ci/prow/e2e-aws-upgrade 044a5c7 link true /test e2e-aws-upgrade

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/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

2 participants