diff --git a/scripts/test/test-env-virtual.sh b/scripts/test/test-env-virtual.sh index 2bf5720..819cdde 100755 --- a/scripts/test/test-env-virtual.sh +++ b/scripts/test/test-env-virtual.sh @@ -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 \ No newline at end of file +fi