Skip to content

Conversation

@wangke19
Copy link
Contributor

Summary

Migrate the serving-cert-secret-add-data test to OTE (OpenShift Tests Extension) framework following the established pattern from PR #297 and PR #298.

This test verifies that extra data added to a serving cert secret will NOT cause the TLS certificate to be regenerated (the controller should not remove extra data).

Changes

  • Extract and share - Moved inline test body from e2e_test.go into shared function testServingCertSecretAddData()
  • Zero duplication - Both standard Go tests and Ginkgo tests call the same shared function
  • Dual compatibility - Function uses testing.TB interface for both frameworks
  • No new test logic - All code moved from existing e2e_test.go test

Test Plan

Local verification:

# Standard Go test
export KUBECONFIG=/path/to/kubeconfig
go test -v ./test/e2e -run TestE2E/serving-cert-secret-add-data

# OTE test
make build
./service-ca-operator-tests-ext list | grep serving-cert-secret-add-data
./service-ca-operator-tests-ext run-suite openshift/conformance/serial -c 1

CI will verify:

  • ✅ Code formatting (make update-gofmt)
  • ✅ Code quality (make verify-govet)
  • ✅ Standard e2e tests pass
  • ✅ OTE tests discovered and run

Files Changed

  • test/e2e/e2e.go - Added Ginkgo wrapper and shared function (+46 lines)
  • test/e2e/e2e_test.go - Refactored to call shared function (-32 lines)

Related PRs

Migration Guide

Following pattern documented in /home/kewang/foothold-ai/OTE_GO_TEST_MIGRATION_GUIDE.md

Key principle: MOVE, DON'T COPY - Extract inline test code into shared functions that both frameworks call.

…lity

Extract inline test body from e2e_test.go into shared function for dual
framework compatibility (standard Go tests and OTE/Ginkgo).

- Add Ginkgo wrapper in test/e2e/e2e.go
- Create testServingCertSecretAddData() shared function
- Refactor e2e_test.go to call shared function
- Zero duplication of test logic

Files changed: 2 (test/e2e/e2e.go, test/e2e/e2e_test.go)
@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

Walkthrough

Refactors the serving certificate secret mutation test by extracting inline test logic from the e2e test suite into a new dedicated helper function testServingCertSecretAddData, reducing duplication and following existing patterns for headless and non-headless test scenarios.

Changes

Cohort / File(s) Summary
E2E Test Refactoring
test/e2e/e2e.go, test/e2e/e2e_test.go
Introduces new helper function testServingCertSecretAddData that encapsulates serving-cert-secret test logic (namespace creation, service setup, secret mutation, and TLS cert verification), and updates the test invocation to call this helper instead of inline code

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • 📝 Generate docstrings

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 12, 2026
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/e2e.go:
- Around line 49-55: The Ginkgo test description is incorrect: update the
description string in the g.It call that wraps testServingCertSecretAddData to
reflect that extra data is removed (not preserved). Modify the fmt.Sprintf
message used in the g.It invocation (the test name passed to g.It) to say
something like "should remove extra data from serving cert secrets with
headless=%v" (or otherwise match the function docstring and assertions performed
by testServingCertSecretAddData, which relies on pollForSecretChangeGinkgo and
checkServiceServingCertSecretData to verify the "foo" key is removed while
TLSCertKey remains).
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between f74fd04 and 685de04.

📒 Files selected for processing (2)
  • test/e2e/e2e.go
  • test/e2e/e2e_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/e2e_test.go
  • test/e2e/e2e.go
🔇 Additional comments (2)
test/e2e/e2e_test.go (1)

1062-1071: LGTM!

The refactoring follows the established pattern used by other migrated tests (serving-cert-annotation, serving-cert-secret-modify-bad-tlsCert). The migration comment is consistent and the delegation to the shared function maintains test behavior.

test/e2e/e2e.go (1)

315-353: LGTM!

The function implementation correctly follows the pattern established by testServingCertSecretModifyBadTLSCert. The test logic properly verifies that adding extra data triggers cleanup by the controller without regenerating the TLS certificate.

@wangke19 wangke19 changed the title test/e2e: migrate serving-cert-secret-add-data test for OTE compatibility CNTRLPLANE-2491:test/e2e: migrate serving-cert-secret-add-data test for OTE compatibility Jan 12, 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 Jan 12, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 12, 2026

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

Details

In response to this:

Summary

Migrate the serving-cert-secret-add-data test to OTE (OpenShift Tests Extension) framework following the established pattern from PR #297 and PR #298.

This test verifies that extra data added to a serving cert secret will NOT cause the TLS certificate to be regenerated (the controller should not remove extra data).

Changes

  • Extract and share - Moved inline test body from e2e_test.go into shared function testServingCertSecretAddData()
  • Zero duplication - Both standard Go tests and Ginkgo tests call the same shared function
  • Dual compatibility - Function uses testing.TB interface for both frameworks
  • No new test logic - All code moved from existing e2e_test.go test

Test Plan

Local verification:

# Standard Go test
export KUBECONFIG=/path/to/kubeconfig
go test -v ./test/e2e -run TestE2E/serving-cert-secret-add-data

# OTE test
make build
./service-ca-operator-tests-ext list | grep serving-cert-secret-add-data
./service-ca-operator-tests-ext run-suite openshift/conformance/serial -c 1

CI will verify:

  • ✅ Code formatting (make update-gofmt)
  • ✅ Code quality (make verify-govet)
  • ✅ Standard e2e tests pass
  • ✅ OTE tests discovered and run

Files Changed

  • test/e2e/e2e.go - Added Ginkgo wrapper and shared function (+46 lines)
  • test/e2e/e2e_test.go - Refactored to call shared function (-32 lines)

Related PRs

Migration Guide

Following pattern documented in /home/kewang/foothold-ai/OTE_GO_TEST_MIGRATION_GUIDE.md

Key principle: MOVE, DON'T COPY - Extract inline test code into shared functions that both frameworks call.

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.

@gangwgr
Copy link

gangwgr commented Jan 12, 2026

/lgtm

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

openshift-ci bot commented Jan 12, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gangwgr, wangke19

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@wangke19
Copy link
Contributor Author

/verified by CI tests

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jan 12, 2026
@openshift-ci-robot
Copy link
Contributor

@wangke19: This PR has been marked as verified by CI tests.

Details

In response to this:

/verified by CI tests

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.

@wangke19
Copy link
Contributor Author

/test e2e-aws

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 12, 2026

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

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants