aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-test-harness
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-02 11:09:52 +0900
committernsfisis <nsfisis@gmail.com>2026-05-02 11:09:52 +0900
commit2ff728fe6796506be0e6b640ccb85ed3e1ce2b56 (patch)
tree5a15af2caa562be6c43d54e6b64ddff3681a97cb /crates/mozart-test-harness
parent4d587407cc9471dc8bfc0544eac0f8c7041fba0d (diff)
downloadphp-mozart-2ff728fe6796506be0e6b640ccb85ed3e1ce2b56.tar.gz
php-mozart-2ff728fe6796506be0e6b640ccb85ed3e1ce2b56.tar.zst
php-mozart-2ff728fe6796506be0e6b640ccb85ed3e1ce2b56.zip
test(harness): force unreachable proxy for spawned mozart
Composer fixtures with inline `package` repositories often set `dist.url` / `source.url` to RFC 2606 placeholders like `https://example.org`. Composer's PHPUnit suite swaps in InstallationManagerMock; Mozart's harness invokes the real binary, so its `reqwest`-based downloader actually hit the network and hung for ~30s per fixture before failing. Setting HTTP_PROXY / HTTPS_PROXY / NO_PROXY on the child process routes every HTTP request through 127.0.0.1:1, which fails the TCP connect immediately. The current 103 green installer tests remain green (resolver short-circuits before download); the ignored update_downgrades_unstable_packages now errors in 0.1s instead of 30s, which is the safety net we want as more inline-package fixtures get unignored. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-test-harness')
-rw-r--r--crates/mozart-test-harness/src/runner.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/mozart-test-harness/src/runner.rs b/crates/mozart-test-harness/src/runner.rs
index cefd50f..acff8b5 100644
--- a/crates/mozart-test-harness/src/runner.rs
+++ b/crates/mozart-test-harness/src/runner.rs
@@ -46,9 +46,17 @@ pub fn run_test(test: &ParsedTest, mozart_bin: &Path) -> Result<RunResult> {
}
let args: Vec<&str> = test.run.split_whitespace().collect();
+ // Force a non-routable proxy so any stray HTTP request from `mozart`
+ // (e.g. inline `package` fixtures whose dist.url points at example.org)
+ // fails fast instead of hitting the network. Composer's PHPUnit suite
+ // uses InstallationManagerMock; we can't mock the binary's HTTP client,
+ // but `reqwest` honors HTTP(S)_PROXY env vars by default.
let output = Command::new(mozart_bin)
.args(&args)
.current_dir(root)
+ .env("HTTP_PROXY", "http://127.0.0.1:1")
+ .env("HTTPS_PROXY", "http://127.0.0.1:1")
+ .env("NO_PROXY", "")
.output()
.with_context(|| format!("failed to invoke {}", mozart_bin.display()))?;