Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test(hosted): isolate package-manager caches in the production e2e suite
e2e_hosted_production.rs drives a real install for every ecosystem it
covers — npm, pnpm, yarn, bun, go, pip, gem, bundler, composer, nuget —
through one `tool()` helper. That helper pins a private cache per leg for
the toolchains each leg names, but everything it does not name still
resolves out of the caller's home directory. Corepack is the big one: the
first `pnpm`/`yarn` invocation downloads a whole package manager into
~/.cache/node/corepack.

`cache_env::isolate()` is the same one-liner the rest of the CLI
integration suites use. It goes in before the per-leg `env` entries so
those still win, which is what keeps the deliberately-cold reinstall legs
cold.

Split out of the sibling change that isolates the other suites, because
this file's CI leg (`hosted-e2e`) is currently red for an unrelated
server-side reason and should not hold that PR up.
  • Loading branch information
jdalton committed Aug 2, 2026
commit f5f644d5411857d248ce8adc5646ac6a213be7e8
7 changes: 7 additions & 0 deletions crates/socket-patch-cli/tests/e2e_hosted_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ use std::process::{Command, Output};

use socket_patch_cli::args::{GLOBAL_ARG_ENV_VARS, LOCAL_ARG_ENV_VARS};

#[path = "common/cache_env.rs"]
mod cache_env;

// ---------------------------------------------------------------------------
// Production endpoints + required-patch catalog
// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -358,6 +361,10 @@ fn redirected_count(env: &serde_json::Value) -> u64 {
fn tool(cwd: &Path, program: &str, args: &[&str], env: &[(&str, &str)]) -> Output {
let mut cmd = Command::new(program);
cmd.args(args).current_dir(cwd);
// Sandbox everything the per-leg `env` below does not name — corepack's
// downloaded package managers most of all — so a run leaves the caller's
// home alone.
cache_env::isolate(&mut cmd);
// Keep every toolchain's cache inside the fixture so the reinstall leg
// starts genuinely cold and cannot be satisfied from a warm host cache
// holding the *pristine* artifact.
Expand Down
Loading