No code in code for the container tests (operator denial d8b0c6c8; operator choice 13bec2bf: swarm funnel; fits Quality req 018 clean.embedded-code). The five host scripts no longer embed an in-container script as bash -lc; each runs a file with bash -l: test-unit.sh and test-integration.sh call scripts/test/container/unittest.sh with tests/unit or tests/integration, test-e2e.sh calls container/e2e.sh, test-env-virtual.sh calls container/env-virtual.sh, test-env-nix.sh calls container/env-nix.sh with IMAGE and PKGMGR_DISTRO as arguments. Commands, order, strict-mode lines, env vars, volumes and workdir are unchanged. | 🌿 Branch | 📊 Diff stat | 🎯 Fix | 💥 Break | 💸 Tokens | ⏱️ Velocity | 🛡️ Security | 🏆 Score | Gate | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | chore/test-scripts-no-inline | 9 files +116/-127 | 90 % | 4 % | – | – | 100 % | 86 | ✅ 90/5, tokens and velocity <= 100, security 100 % | Evidence: shellcheck -x clean on all 9 files, no bash -lc block left under scripts/, MEDUSA 100 % critical 0 (2 SC1091 scanner artefacts accepted). Break 4 %: unproven until PR CI runs the containers. Operator review a493a79a (re-card of f877c5dd). Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.5 KiB
Bash
Executable File
47 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Param: $1 IMAGE, the image name shown in the missing-nix error.
|
|
# Param: $2 PKGMGR_DISTRO, the distro shown in the missing-nix error.
|
|
IMAGE="$1"
|
|
PKGMGR_DISTRO="$2"
|
|
|
|
if command -v git >/dev/null 2>&1; then
|
|
git config --global --add safe.directory /opt/src/pkgmgr || true
|
|
git config --global --add safe.directory /opt/src/pkgmgr/.git || true
|
|
git config --global --add safe.directory "*" || true
|
|
fi
|
|
|
|
echo ">>> preflight: nix must exist in image"
|
|
if ! command -v nix >/dev/null 2>&1; then
|
|
echo "NO_NIX"
|
|
echo "ERROR: nix not found in image ${IMAGE} (PKGMGR_DISTRO=${PKGMGR_DISTRO})"
|
|
echo "HINT: Ensure Nix is installed during image build for this distro."
|
|
exit 1
|
|
fi
|
|
|
|
echo ">>> nix version"
|
|
nix --version
|
|
|
|
if [[ -f /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh ]]; then
|
|
# shellcheck source=SCRIPTDIR/../../nix/lib/retry_403.sh
|
|
source /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh
|
|
elif [[ -f ./scripts/nix/lib/retry_403.sh ]]; then
|
|
# shellcheck source=SCRIPTDIR/../../nix/lib/retry_403.sh
|
|
source ./scripts/nix/lib/retry_403.sh
|
|
else
|
|
echo "ERROR: retry helper not found: scripts/nix/lib/retry_403.sh"
|
|
exit 1
|
|
fi
|
|
|
|
echo ">>> nix flake show"
|
|
run_with_github_403_retry nix flake show . --no-write-lock-file >/dev/null
|
|
|
|
echo ">>> nix build .#default"
|
|
run_with_github_403_retry nix build .#default --no-link --no-write-lock-file
|
|
|
|
echo ">>> nix run .#pkgmgr -- --help"
|
|
run_with_github_403_retry nix run .#pkgmgr -- --help --no-write-lock-file
|
|
|
|
echo ">>> OK: Nix flake-only test succeeded."
|