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 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-12-02 09:47:45 +00:00
1 parent dca0b5823b
commit 0696ce31e7
1 file changed
+9
+9
View File
@@ -794,6 +794,8 @@ if ! command -v git > /dev/null 2>&1 \
echo " $SKIP_REASON" echo " $SKIP_REASON"
else else
PROBE="$(mktemp -d)" 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 trap 'rm -rf "$FAKE_BIN" "$WORK" "$TOOLS" "$UV_BIN" "$PIN_BIN" "$PATH_APM_BIN" "$PINNED" "$PROBE"' EXIT
UPSTREAM="$PROBE/upstream.git" UPSTREAM="$PROBE/upstream.git"
@@ -837,9 +839,16 @@ else
echo "deployments: []" echo "deployments: []"
} > "$PROBE/consumer/apm.lock.yaml" } > "$PROBE/consumer/apm.lock.yaml"
# env cannot run a shell function, so probe_apm is re-declared in a child bash. # 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" && cd "$PROBE/consumer" &&
env HOME="$PROBE/home" \ 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_GLOBAL="$PROBE/gitconfig" \
GIT_CONFIG_NOSYSTEM=1 \ GIT_CONFIG_NOSYSTEM=1 \
GIT_TERMINAL_PROMPT=0 \ GIT_TERMINAL_PROMPT=0 \