From 0696ce31e7c47c42c220dee2e02df56f0f5c0d95 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Wed, 2 Dec 2026 09:47:45 +0000 Subject: [PATCH] test(kyberforge): keep the real-apm probe off the network The probe moves HOME to an empty dir, which also moved uv's cache and its managed Pythons, leaving uv cold. Pin UV_CACHE_DIR and UV_PYTHON_INSTALL_DIR to the real ones resolved beforehand, and set UV_OFFLINE so the probe runs the synced pin and never fetches. Verified under `unshare -rn`. Refs: #271 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi --- tests/test-apm-current-hook.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test-apm-current-hook.sh b/tests/test-apm-current-hook.sh index 8408d9c..ca7c5c8 100755 --- a/tests/test-apm-current-hook.sh +++ b/tests/test-apm-current-hook.sh @@ -794,6 +794,8 @@ if ! command -v git > /dev/null 2>&1 \ echo " $SKIP_REASON" else PROBE="$(mktemp -d)" + UV_REAL_CACHE="${UV_CACHE_DIR:-$(uv cache dir 2> /dev/null || true)}" + UV_REAL_PYTHONS="${UV_PYTHON_INSTALL_DIR:-$(uv python dir 2> /dev/null || true)}" trap 'rm -rf "$FAKE_BIN" "$WORK" "$TOOLS" "$UV_BIN" "$PIN_BIN" "$PATH_APM_BIN" "$PINNED" "$PROBE"' EXIT UPSTREAM="$PROBE/upstream.git" @@ -837,9 +839,16 @@ else echo "deployments: []" } > "$PROBE/consumer/apm.lock.yaml" # env cannot run a shell function, so probe_apm is re-declared in a child bash. + # HOME moves to an empty dir, so uv's cache and its managed Pythons (both + # under HOME by default) are pinned to the real ones resolved before the + # move, and UV_OFFLINE forbids any fetch: the probe runs the already-synced + # pin and never needs the network. ( cd "$PROBE/consumer" && env HOME="$PROBE/home" \ + UV_CACHE_DIR="$UV_REAL_CACHE" \ + UV_PYTHON_INSTALL_DIR="$UV_REAL_PYTHONS" \ + UV_OFFLINE=1 \ GIT_CONFIG_GLOBAL="$PROBE/gitconfig" \ GIT_CONFIG_NOSYSTEM=1 \ GIT_TERMINAL_PROMPT=0 \