Skip to content

🌱 OPRUN-4573: tests: add unit and e2e tests for HTTPS_PROXY support#2654

Open
tmshort wants to merge 1 commit intooperator-framework:mainfrom
tmshort:proxy-tests
Open

🌱 OPRUN-4573: tests: add unit and e2e tests for HTTPS_PROXY support#2654
tmshort wants to merge 1 commit intooperator-framework:mainfrom
tmshort:proxy-tests

Conversation

@tmshort
Copy link
Copy Markdown
Contributor

@tmshort tmshort commented Apr 15, 2026

Unit tests verify that BuildHTTPClient correctly tunnels HTTPS connections through a proxy and fails when the proxy rejects the CONNECT request.

E2e tests cover two scenarios: a dead proxy that blocks catalog fetches (asserted via "proxyconnect" in the Retrying condition), and a live recording proxy that asserts catalog traffic actually routes through it via CONNECT.

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Copilot AI review requested due to automatic review settings April 15, 2026 21:38
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 15, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 1c6062d
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69e13abacdb3960008f4869a
😎 Deploy Preview https://deploy-preview-2654--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@openshift-ci openshift-ci bot requested review from oceanc80 and perdasilva April 15, 2026 21:38
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 15, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit + e2e test coverage around HTTPS proxying for catalog traffic, including new godog steps to reconfigure controller deployments and a lightweight “recording proxy” used to assert CONNECT tunneling.

Changes:

  • Register new proxy-related godog steps and add scenario cleanup to revert modified deployments / stop the proxy.
  • Add new e2e feature scenarios for “dead proxy blocks fetch” and “recording proxy observes CONNECT to catalogd”.
  • Add unit tests intended to validate HTTPS CONNECT proxy tunneling behavior for BuildHTTPClient.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/e2e/steps/steps.go Registers proxy step definitions in the e2e step registry.
test/e2e/steps/proxy_steps.go Implements deployment env patching helpers and an in-process CONNECT recording proxy.
test/e2e/steps/hooks.go Adds scenario context fields and cleanup to stop proxy + restore deployments.
test/e2e/features/proxy.feature Adds two e2e scenarios covering dead proxy and recording proxy routing assertions.
internal/shared/util/http/httputil_test.go Adds unit tests around proxy CONNECT tunneling behavior for BuildHTTPClient.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/shared/util/http/httputil_test.go Outdated
Comment thread test/e2e/steps/proxy_steps.go Outdated
Comment thread test/e2e/steps/proxy_steps.go Outdated
Comment thread test/e2e/steps/proxy_steps.go Outdated
Comment thread test/e2e/steps/proxy_steps.go
Comment thread test/e2e/steps/hooks.go
@tmshort tmshort force-pushed the proxy-tests branch 2 times, most recently from 43f7355 to 699c428 Compare April 16, 2026 13:44
Copilot AI review requested due to automatic review settings April 16, 2026 13:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new unit and end-to-end coverage intended to validate HTTPS proxy (CONNECT tunneling) behavior for outbound catalog fetches, including scenarios where the proxy is unreachable or where traffic must be observed flowing through a proxy.

Changes:

  • Registers new Godog step definitions for proxy-related E2E scenarios and adds per-scenario cleanup to restore modified deployments.
  • Adds a new E2E feature file covering “dead proxy” and “recording proxy” scenarios for operator-controller catalog requests.
  • Adds unit tests around BuildHTTPClient proxy CONNECT tunneling behavior using an in-test CONNECT proxy.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/e2e/steps/steps.go Registers the new proxy-related step set.
test/e2e/steps/proxy_steps.go Implements an in-process CONNECT proxy + deployment env patching helpers and steps.
test/e2e/steps/hooks.go Tracks/restores deployment env changes and stops the in-process proxy during scenario cleanup.
test/e2e/features/proxy.feature Adds E2E scenarios validating failure via dead proxy and success/verification via recording proxy.
internal/shared/util/http/httputil_test.go Adds unit tests for HTTPS CONNECT tunneling through a proxy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/e2e/steps/proxy_steps.go Outdated
Comment thread test/e2e/steps/hooks.go Outdated
Comment thread internal/shared/util/http/httputil_test.go Outdated
Copilot AI review requested due to automatic review settings April 16, 2026 14:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automated coverage for outbound HTTPS proxying of operator-controller’s catalog fetches, using both unit-level CONNECT proxy tunneling tests and end-to-end scenarios that configure HTTPS_PROXY on the running deployment.

Changes:

  • Register new e2e proxy-related Godog steps and add feature scenarios validating proxy failure/success cases.
  • Add e2e infrastructure: an in-process recording CONNECT proxy plus deployment env patch/restore helpers.
  • Add unit tests that exercise HTTPS-over-CONNECT tunneling behavior for the HTTP client used for catalog traffic.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/e2e/steps/steps.go Registers proxy steps with the existing Godog scenario context.
test/e2e/steps/proxy_steps.go Implements recording CONNECT proxy + deployment patch/restore helpers + step definitions.
test/e2e/steps/hooks.go Extends scenario context and cleanup to restore patched deployments and stop proxy.
test/e2e/features/proxy.feature Adds two e2e scenarios for dead-proxy failure and recording-proxy success.
internal/shared/util/http/httputil_test.go Adds unit tests for HTTPS CONNECT tunneling and proxy rejection behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

http.Error(w, "only CONNECT supported", http.StatusMethodNotAllowed)
return
}
proxied <- r.Host
Comment on lines +114 to +118
// Point the transport directly at our test proxy, bypassing the loopback
// exclusion and env-var caching of http.ProxyFromEnvironment.
transport, ok := client.Transport.(*http.Transport)
require.True(t, ok)
transport.Proxy = http.ProxyURL(proxyURL)
Copilot AI review requested due to automatic review settings April 16, 2026 17:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds coverage for HTTPS proxy behavior used by the operator-controller when fetching catalog content from catalogd, and ensures the shared HTTP client respects proxy environment variables.

Changes:

  • Update BuildHTTPClient to honor HTTPS_PROXY/NO_PROXY via http.ProxyFromEnvironment.
  • Add unit tests validating CONNECT tunneling through a proxy and failure behavior when CONNECT is rejected.
  • Add new e2e feature + step implementations to exercise proxy behavior scenarios (dead proxy + recording proxy).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/shared/util/http/httputil.go Sets Transport.Proxy so runtime proxy env vars are honored.
internal/shared/util/http/httputil_test.go Adds unit tests for CONNECT proxy tunneling and rejection behavior.
test/e2e/features/proxy.feature Introduces e2e scenarios for HTTPS proxy behavior.
test/e2e/steps/proxy_steps.go Implements e2e steps including a recording CONNECT proxy and deployment env patching helpers.
test/e2e/steps/hooks.go Adds scenario cleanup for stopping the proxy and restoring patched deployments.
test/e2e/steps/steps.go Registers the new proxy-related steps.
Makefile Increases E2E timeout to accommodate added scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/e2e/steps/hooks.go Outdated
Comment thread test/e2e/steps/proxy_steps.go
Comment thread test/e2e/steps/proxy_steps.go
Comment thread internal/shared/util/http/httputil_test.go
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.01%. Comparing base (29debc7) to head (1c6062d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2654      +/-   ##
==========================================
+ Coverage   68.89%   69.01%   +0.11%     
==========================================
  Files         141      141              
  Lines       10009    10010       +1     
==========================================
+ Hits         6896     6908      +12     
+ Misses       2596     2587       -9     
+ Partials      517      515       -2     
Flag Coverage Δ
e2e 37.41% <100.00%> (+0.06%) ⬆️
experimental-e2e 52.76% <100.00%> (+0.27%) ⬆️
unit 53.73% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings April 16, 2026 18:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds HTTPS proxy support validation across unit and end-to-end tests, and updates the shared HTTP client builder to honor HTTPS_PROXY/NO_PROXY at runtime.

Changes:

  • Update BuildHTTPClient to set Transport.Proxy = http.ProxyFromEnvironment.
  • Add unit tests that validate HTTPS CONNECT proxy tunneling behavior and failure modes.
  • Add e2e proxy scenarios plus step implementations (including an in-process recording CONNECT proxy) and Makefile support for passing Godog args.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/e2e/steps/steps.go Registers the new proxy-related Godog steps.
test/e2e/steps/proxy_steps.go Implements proxy configuration steps, an in-process recording CONNECT proxy, and deployment patch/restore helpers.
test/e2e/steps/hooks.go Adds scenario cleanup for stopping the recording proxy and restoring patched deployments.
test/e2e/features/proxy.feature Adds e2e scenarios that assert proxy behavior (dead proxy + recording proxy).
internal/shared/util/http/httputil_test.go Adds unit tests for proxy configuration, tunneling through CONNECT, and rejection handling.
internal/shared/util/http/httputil.go Ensures the built transport honors proxy env vars.
Makefile Adds GODOG_ARGS passthrough for e2e runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/shared/util/http/httputil_test.go Outdated
Comment thread internal/shared/util/http/httputil_test.go
Comment thread test/e2e/steps/proxy_steps.go Outdated
Comment thread test/e2e/steps/proxy_steps.go Outdated
@tmshort tmshort changed the title 🌱 tests: add unit and e2e tests for HTTPS_PROXY support 🌱 OPRUN-4573: tests: add unit and e2e tests for HTTPS_PROXY support Apr 16, 2026
Unit tests verify that BuildHTTPClient correctly tunnels HTTPS
connections through a proxy and fails when the proxy rejects the
CONNECT request.

E2e tests cover two scenarios: a dead proxy that blocks catalog
fetches (asserted via "proxyconnect" in the Retrying condition), and
a live recording proxy that asserts catalog traffic actually routes
through it via CONNECT.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Todd Short <tshort@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants