test(env-virtual): execute pkgmgr from Python venv instead of system launcher
Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / linter-shell (push) Has been cancelled
Mark stable commit / linter-python (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled

The virtual environment test no longer invokes the distro-installed pkgmgr launcher (Nix-based).
Instead, it explicitly installs and activates the Python venv via make setup-venv and runs pkgmgr from there.

This aligns the test with its actual purpose (venv validation), avoids accidental execution of the Nix launcher, and fixes the failure caused by the missing run_with_github_403_retry helper in the venv workflow.

https://chatgpt.com/share/693ee224-e838-800f-8fa0-45295b2f5e20
This commit is contained in:
Kevin Veen-Birkenbach
2025-12-14 17:12:48 +01:00
parent a3aa7b6394
commit 33dfbf3a4d

View File

@@ -1,32 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail
IMAGE="pkgmgr-$PKGMGR_DISTRO"
IMAGE="pkgmgr-${PKGMGR_DISTRO}"
echo
echo "------------------------------------------------------------"
echo ">>> Testing VENV: $IMAGE"
echo ">>> Testing VENV: ${IMAGE}"
echo "------------------------------------------------------------"
echo "[test-env-virtual] Inspect image metadata:"
docker image inspect "$IMAGE" | sed -n '1,40p'
echo "[test-env-virtual] Running: docker run --rm --entrypoint pkgmgr $IMAGE --help"
docker image inspect "${IMAGE}" | sed -n '1,40p'
echo
# Run the command and capture the output
# ------------------------------------------------------------
# Run VENV-based pkgmgr test inside container
# ------------------------------------------------------------
if OUTPUT=$(docker run --rm \
-e REINSTALL_PKGMGR=1 \
-v "pkgmgr_nix_store_${PKGMGR_DISTRO}:/nix" \
-v "$(pwd):/src" \
-v "pkgmgr_nix_cache_${PKGMGR_DISTRO}:/root/.cache/nix" \
"$IMAGE" 2>&1); then
-e REINSTALL_PKGMGR=1 \
-v "$(pwd):/src" \
-w /src \
"${IMAGE}" \
bash -lc '
set -euo pipefail
echo "[test-env-virtual] Installing pkgmgr (distro package)..."
make install
echo "[test-env-virtual] Setting up Python venv..."
make setup-venv
echo "[test-env-virtual] Activating venv..."
. "$HOME/.venvs/pkgmgr/bin/activate"
echo "[test-env-virtual] Using pkgmgr from:"
command -v pkgmgr
pkgmgr --help
' 2>&1); then
echo "$OUTPUT"
echo
echo "[test-env-virtual] SUCCESS: $IMAGE responded to 'pkgmgr --help'"
echo "[test-env-virtual] SUCCESS: venv-based pkgmgr works in ${IMAGE}"
else
echo "$OUTPUT"
echo
echo "[test-env-virtual] ERROR: $IMAGE failed to run 'pkgmgr --help'"
echo "[test-env-virtual] ERROR: venv-based pkgmgr failed in ${IMAGE}"
exit 1
fi