NE-2839: Add HAProxy version upgrade tests - #31495
Conversation
The IngressControllerMultipleHAProxyVersions feature allows selecting HAProxy versions per IngressController. During y-stream upgrades (e.g. 4.22 to 5.0), the default HAProxy version may change (2.8 to 3.2). Two upgrade scenarios need validation: - Pinned version: an IngressController with an explicitly set HAProxyVersion must retain that version across any upgrade, regardless of default version changes. - Unset version: an IngressController with no HAProxyVersion set must follow the new release default after upgrade. Both tests create a custom IngressController before upgrade, wait for the upgrade to complete, then verify the expected HAProxy version via both the IngressController status (EffectiveHAProxyVersion) and the HAProxy runtime socket. Also refactors multi-haproxy.go to extract shared helpers (apiHasHAProxyVersionField, deleteAll) used by both the day-2 tests and the new upgrade tests. https://redhat.atlassian.net/browse/NE-2839 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
@jcmoraisjr: This pull request references NE-2839 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 story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
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. |
WalkthroughThe router upgrade suite adds pinned and unpinned HAProxy version tests. It detects API support, validates status and runtime versions after upgrade, derives the default version, and uses shared CRD detection and cleanup helpers. ChangesHAProxy version upgrade testing
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant HAProxyVersionUpgradeTest
participant UpgradeFramework
participant IngressController
participant HAProxyRuntimeAPI
HAProxyVersionUpgradeTest->>UpgradeFramework: wait for upgrade completion
HAProxyVersionUpgradeTest->>IngressController: read effective HAProxy version
HAProxyVersionUpgradeTest->>HAProxyRuntimeAPI: verify runtime version
HAProxyVersionUpgradeTest->>IngressController: delete test resource
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (13 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jcmoraisjr The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/extended/router/haproxyversion_upgrade.go`:
- Around line 143-151: The Teardown cleanup in
test/extended/router/haproxyversion_upgrade.go:143-151 and the corresponding
cleanup in test/extended/router/multi-haproxy.go:55-58 must use an uncancelable
base context with a bounded timeout when calling controllers.deleteAll, rather
than the canceled test context; preserve the existing resource checks and error
logging.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 36092e16-5729-4422-815b-dad8eebbcd3a
📒 Files selected for processing (3)
test/e2e/upgrade/upgrade.gotest/extended/router/haproxyversion_upgrade.gotest/extended/router/multi-haproxy.go
| func (h *HAProxyVersionUpgradeTest) Teardown(ctx context.Context, f *framework.Framework) { | ||
| if h.operatorClient == nil { | ||
| framework.Logf("Skipping cleanup because setup did not initialize test resources") | ||
| return | ||
| } | ||
| if err := h.controllers.deleteAll(ctx, h.operatorClient); err != nil { | ||
| framework.Logf("error deleting IngressController resource: %s", err.Error()) | ||
| } | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify that the declared toolchain supports context.WithoutCancel.
rg -n '^(go|toolchain) ' go.mod
# Inspect both cleanup call sites.
rg -n -C 5 'deleteAll\(' test/extended/router/multi-haproxy.go test/extended/router/haproxyversion_upgrade.goRepository: openshift/origin
Length of output: 2816
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect imports and surrounding cleanup context usage in both test files.
for f in test/extended/router/multi-haproxy.go test/extended/router/haproxyversion_upgrade.go; do
echo "===== $f ====="
sed -n '1,90p' "$f"
echo
done
# Search for IngressController deletion helpers and context use around cleanup.
rg -n -C 4 'deleteAll|i\.Delete\(|OperatorV1\(\)\.IngressControllers|context\.With|context\.Background|context\.Timeout|context\.WithoutCancel' test/extended/router test -g '*.go' | head -n 200Repository: openshift/origin
Length of output: 21383
Use bounded cleanup contexts.
A canceled test context can make deleteAll fail before it sends deletion requests. Use an uncancelable cleanup base context with a timeout before calling deleteAll in both cleanup paths.
📍 Affects 2 files
test/extended/router/haproxyversion_upgrade.go#L143-L151(this comment)test/extended/router/multi-haproxy.go#L55-L58
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/extended/router/haproxyversion_upgrade.go` around lines 143 - 151, The
Teardown cleanup in test/extended/router/haproxyversion_upgrade.go:143-151 and
the corresponding cleanup in test/extended/router/multi-haproxy.go:55-58 must
use an uncancelable base context with a bounded timeout when calling
controllers.deleteAll, rather than the canceled test context; preserve the
existing resource checks and error logging.
Sources: Path instructions, Learnings
|
Scheduling required tests: Scheduling tests matching the |
|
/payload-job-with-prs ? |
|
@jcmoraisjr: it appears that you have attempted to use some version of the payload command, but your comment was incorrectly formatted and cannot be acted upon. See the docs for usage info. |
|
/payload-job-with-prs |
|
@jcmoraisjr: it appears that you have attempted to use some version of the payload command, but your comment was incorrectly formatted and cannot be acted upon. See the docs for usage info. |
|
/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade openshift/api#2971 openshift/cluster-ingress-operator#1545 |
|
@jcmoraisjr: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/c80a2da0-92a7-11f1-9749-1b41a869f83d-0 |
|
/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-upgrade openshift/api#2971 openshift/cluster-ingress-operator#1545 |
|
@jcmoraisjr: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/03588550-92a8-11f1-8016-b7673b47292e-0 |
|
/payload-job-with-prs periodic-ci-openshift-release-main-ci-4.22-e2e-aws-ovn-upgrade openshift/api#2971 openshift/cluster-ingress-operator#1545 |
|
@jcmoraisjr: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/204e9d20-92a8-11f1-96af-9e21d2a7ed7f-0 |
|
@jcmoraisjr: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
Risk analysis has seen new tests most likely introduced by this PR. New tests seen in this PR at sha: 60d4a8f
|
The IngressControllerMultipleHAProxyVersions feature allows selecting HAProxy versions per IngressController. During y-stream upgrades (e.g. 4.22 to 5.0), the default HAProxy version may change (2.8 to 3.2). Two upgrade scenarios need validation:
Both tests create a custom IngressController before upgrade, wait for the upgrade to complete, then verify the expected HAProxy version via both the IngressController status (EffectiveHAProxyVersion) and the HAProxy runtime socket.
Also refactors multi-haproxy.go to extract shared helpers (apiHasHAProxyVersionField, deleteAll) used by both the day-2 tests and the new upgrade tests.
https://redhat.atlassian.net/browse/NE-2839
Summary by CodeRabbit