Fix fleet e2e test SL count off-by-one in port-forward mode - #272
Fix fleet e2e test SL count off-by-one in port-forward mode#272redhat-chai-bot wants to merge 1 commit into
Conversation
When OCM_AGENT_URL is set (Prow CI port-forward mode), the HCP fleet test was sending alerts to the regular ocm-agent instead of the fleet-mode ocm-agent, causing service log count mismatches. The root cause was that the fleet test used ocmAgentURL (overridden by OCM_AGENT_URL to point at the regular agent) for PostAlert, while only falling back to ocmAgentFleetURL when OCM_AGENT_URL was unset. This fix: - Adds OCM_AGENT_FLEET_URL env var support for explicit fleet URL override - When OCM_AGENT_URL is set but OCM_AGENT_FLEET_URL is not, starts a kubectl port-forward to svc/ocm-agent-fleet on port 8082 and uses http://localhost:8082 as the fleet URL - Cleans up the port-forward process via defer when the fleet test ends - Uses ocmAgentFleetURL consistently for all fleet-mode operations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Advanced Run ID: Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: redhat-chai-bot 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 |
|
@redhat-chai-bot: all tests passed! 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #272 +/- ##
=======================================
Coverage 56.46% 56.46%
=======================================
Files 23 23
Lines 1934 1934
=======================================
Hits 1092 1092
Misses 786 786
Partials 56 56 🚀 New features to boost your workflow:
|
Summary
Fixes the HCP fleet mode e2e test failure (
Expected SL count: 27, Got SL count: 26) when running in Prow CI withOCM_AGENT_URLport-forward mode.Root Cause
When
OCM_AGENT_URLis set (Prow CI uses localhost:8081 viakubectl port-forward), the fleet mode test sends alerts to the regularocm-agentendpoint instead of theocm-agent-fleetendpoint. The regular ocm-agent ignores fleet alerts, so no service log is created.The issue is in the fleet test's URL selection logic — the
ocmAgentFleetURLoverride is skipped whenOCM_AGENT_URLis set. Theocm-agent-fleetdeployment is created dynamically by the test, so the step script's staticPORT_FORWARD_SVCcannot reach it.Fix
Both env var AND test-level port-forward (Option C):
OCM_AGENT_FLEET_URLenv var support — If set, overrides the fleet URL (likeOCM_AGENT_URLdoes for the regular endpoint).Automatic
kubectl port-forward— WhenOCM_AGENT_URLis set butOCM_AGENT_FLEET_URLis not, the test automatically runskubectl port-forward svc/ocm-agent-fleet 8082:8081after creating the fleet deployment, and setsocmAgentFleetURLto localhost:8082. The port-forward process is cleaned up viadefer cmd.Process.Kill().Fleet URL used for PostAlert — The fleet test now uses
ocmAgentFleetURL(notocmAgentURL) when posting fleet alerts, ensuring alerts reach the fleet-mode ocm-agent regardless of the operating mode.Operating Modes
OCM_AGENT_URLset — auto port-forwards fleet svc to localhost:8082Testing
make lint— 0 issuesmake test— all unit tests passRef: ROSAENG-61843
AI-generated. Review for accuracy.
@dustman9000 requested via Chai Bot