Make proxy integration tests hermetic (#178)#179
Merged
Conversation
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>
e578ba1 to
4617a7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #178.
Problem
AirflowPerspectiveITandProxyITconfigured the Airflow proxy to forward to external hosts (httpbin.organdapi.ipify.org). Whenever those services were slow, rate-limited, or temporarily down, the tests failed — producing redpull-request / integration-testschecks on changes that had nothing to do with the proxy. This is exactly what happened on #177 (the13.1.0 → 13.2.0parent bump): the proxied iframe rendered httpbin.org's transient503 Service Temporarily Unavailablepage, 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 fixedtext/htmlbody on an OS-assigned ephemeral port.AirflowPerspectiveIT— pointsPHOEBE_AIRFLOW_URLat 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 onapi.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
TextResponseBodyRewriterTestunit test.Verification
Both tests pass locally and reach no external network host:
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