Skip to content

Make proxy integration tests hermetic (#178)#179

Merged
iliyan-velichkov merged 1 commit into
mainfrom
harden-proxy-it-178
Jun 8, 2026
Merged

Make proxy integration tests hermetic (#178)#179
iliyan-velichkov merged 1 commit into
mainfrom
harden-proxy-it-178

Conversation

@iliyan-velichkov

Copy link
Copy Markdown
Collaborator

Closes #178.

Problem

AirflowPerspectiveIT and ProxyIT configured the Airflow proxy to forward to external hosts (httpbin.org and api.ipify.org). Whenever those services were slow, rate-limited, or temporarily down, the tests failed — producing red pull-request / integration-tests checks on changes that had nothing to do with the proxy. This is exactly what happened on #177 (the 13.1.0 → 13.2.0 parent bump): the proxied iframe rendered httpbin.org's transient 503 Service Temporarily Unavailable page, and a plain re-run went green once the upstream recovered.

Change

  • LocalHttpStub — a minimal HTTP server backed by the JDK (com.sun.net.httpserver, no new dependency) that serves a fixed text/html body on an OS-assigned ephemeral port.
  • AirflowPerspectiveIT — points PHOEBE_AIRFLOW_URL at the stub and asserts the stubbed <h2> renders inside the proxied iframe. No external host.
  • ProxyIT — points at the stub, which returns a root-relative link (/airflow/home), and asserts the proxy rewrites it to /services/airflow/airflow/home — verifying the rewriting behavior end-to-end against a controlled response instead of relying on api.ipify.org.

The stub URL is set in a static initializer (before the Spring context / proxy beans start, matching the previous pattern) and the server is stopped in @AfterAll.

The detailed body-rewriting rules remain covered by the existing TextResponseBodyRewriterTest unit test.

Verification

Both tests pass locally and reach no external network host:

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 -- in com.codbex.phoebe.integration.tests.ProxyIT
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 -- in com.codbex.phoebe.integration.tests.AirflowPerspectiveIT
[INFO] BUILD SUCCESS

Log line confirming the proxy targets the local stub: Configuring Airflow proxy for path [/services/airflow/**] to URL [http://localhost:52246].

🤖 Generated with Claude Code

AirflowPerspectiveIT and ProxyIT pointed the Airflow proxy at external
hosts (httpbin.org / api.ipify.org), so they failed whenever those
services were slow, rate-limited or down. This produced spurious red
checks on unrelated PRs (e.g. the parent bump in #177, where httpbin.org
returned a transient 503).

Replace the external targets with a local JDK-based HTTP stub
(LocalHttpStub, no new dependency) that serves a fixed response on an
ephemeral port. AirflowPerspectiveIT now asserts the stubbed page renders
in the proxied iframe; ProxyIT asserts the proxy rewrites a root-relative
link in the stub response to stay under /services/airflow. Both tests are
now fully hermetic and reach no external network host.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@iliyan-velichkov iliyan-velichkov self-assigned this Jun 8, 2026
@iliyan-velichkov iliyan-velichkov merged commit e603303 into main Jun 8, 2026
8 checks passed
@iliyan-velichkov iliyan-velichkov deleted the harden-proxy-it-178 branch June 8, 2026 12:26
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.

Harden proxy integration tests: remove dependency on external httpbin.org / api.ipify.org (flaky)

1 participant