chore(test): fold the container scripts to clear the quality findings
quality clean.prefix-groups: env-nix.sh and env-virtual.sh move to scripts/test/container/env/nix.sh and env/virtual.sh; their only callers, scripts/test/test-env-nix.sh and test-env-virtual.sh, are updated. clean.clones: the shared git safe.directory block of e2e.sh and env-nix.sh is one script, scripts/test/container/safe-directory.sh, called at the same spot. clean.comment: parameter lines use the form # Param: NAME ($n) - text. coding.shell-lint SC1091: quality runs shellcheck without -x, so the source directives are shellcheck source=/dev/null like the sibling scripts; the sourcing logic is unchanged. | 🌿 Branch | 📊 Diff stat | 🎯 Fix | 💥 Break | 💸 Tokens | ⏱️ Velocity | 🛡️ Security | 🏆 Score | Gate | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | chore/test-scripts-no-inline | 7 files +17/-17 | 92 % | 3 % | – | – | 100 % | 89 | ✅ 90/5, tokens and velocity <= 100, security 100 % | Evidence: quality check --staged 0 findings, shellcheck --norc clean on all 7 scripts, MEDUSA 100 %, critical 0. The container jobs of PR CI are the proof. Hub review 42b3a76554491026. Refs https://github.com/kevinveenbirkenbach/package-manager/pull/20 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a9ac39ad4
commit
4cb00eec18
7 files changed
+17
-17
No files matched your search
@@ -25,11 +25,7 @@ command -v nix >/dev/null || {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if command -v git >/dev/null 2>&1; then
|
bash scripts/test/container/safe-directory.sh
|
||||||
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
|
|
||||||
|
|
||||||
nix develop .#default --no-write-lock-file -c \
|
nix develop .#default --no-write-lock-file -c \
|
||||||
python3 -m unittest discover \
|
python3 -m unittest discover \
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Param: $1 IMAGE, the image name shown in the missing-nix error.
|
# Param: IMAGE ($1) - the image name shown in the missing-nix error.
|
||||||
# Param: $2 PKGMGR_DISTRO, the distro shown in the missing-nix error.
|
# Param: PKGMGR_DISTRO ($2) - the distro shown in the missing-nix error.
|
||||||
IMAGE="$1"
|
IMAGE="$1"
|
||||||
PKGMGR_DISTRO="$2"
|
PKGMGR_DISTRO="$2"
|
||||||
|
|
||||||
if command -v git >/dev/null 2>&1; then
|
bash scripts/test/container/safe-directory.sh
|
||||||
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"
|
echo ">>> preflight: nix must exist in image"
|
||||||
if ! command -v nix >/dev/null 2>&1; then
|
if ! command -v nix >/dev/null 2>&1; then
|
||||||
@@ -24,10 +20,10 @@ echo ">>> nix version"
|
|||||||
nix --version
|
nix --version
|
||||||
|
|
||||||
if [[ -f /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh ]]; then
|
if [[ -f /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh ]]; then
|
||||||
# shellcheck source=SCRIPTDIR/../../nix/lib/retry_403.sh
|
# shellcheck source=/dev/null
|
||||||
source /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh
|
source /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh
|
||||||
elif [[ -f ./scripts/nix/lib/retry_403.sh ]]; then
|
elif [[ -f ./scripts/nix/lib/retry_403.sh ]]; then
|
||||||
# shellcheck source=SCRIPTDIR/../../nix/lib/retry_403.sh
|
# shellcheck source=/dev/null
|
||||||
source ./scripts/nix/lib/retry_403.sh
|
source ./scripts/nix/lib/retry_403.sh
|
||||||
else
|
else
|
||||||
echo "ERROR: retry helper not found: scripts/nix/lib/retry_403.sh"
|
echo "ERROR: retry helper not found: scripts/nix/lib/retry_403.sh"
|
||||||
File renamed without changes.
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
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
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Param: $1 the test folder to discover, tests/unit or tests/integration.
|
# Param: suite ($1) - the test folder to discover, tests/unit or tests/integration.
|
||||||
suite="$1"
|
suite="$1"
|
||||||
|
|
||||||
git config --global --add safe.directory /opt/src/pkgmgr || true
|
git config --global --add safe.directory /opt/src/pkgmgr || true
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ docker run --rm \
|
|||||||
-e REINSTALL_PKGMGR=1 \
|
-e REINSTALL_PKGMGR=1 \
|
||||||
-e NIX_CONFIG="${NIX_CONFIG}" \
|
-e NIX_CONFIG="${NIX_CONFIG}" \
|
||||||
"${IMAGE}" \
|
"${IMAGE}" \
|
||||||
bash -l scripts/test/container/env-nix.sh "${IMAGE}" "${PKGMGR_DISTRO}"
|
bash -l scripts/test/container/env/nix.sh "${IMAGE}" "${PKGMGR_DISTRO}"
|
||||||
@@ -18,7 +18,7 @@ if OUTPUT=$(docker run --rm \
|
|||||||
-w /opt/src/pkgmgr \
|
-w /opt/src/pkgmgr \
|
||||||
-e NIX_CONFIG="${NIX_CONFIG}" \
|
-e NIX_CONFIG="${NIX_CONFIG}" \
|
||||||
"${IMAGE}" \
|
"${IMAGE}" \
|
||||||
bash -l scripts/test/container/env-virtual.sh 2>&1); then
|
bash -l scripts/test/container/env/virtual.sh 2>&1); then
|
||||||
|
|
||||||
echo "$OUTPUT"
|
echo "$OUTPUT"
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in new issue
Block a user