Files
proxdeploy/tests/container/profile-pruefen.sh
T
florian.wildeandClaude Opus 5.5 db57818eb3 fix(adapter): Benutzer anlegen, auch wenn die Gruppe schon existiert
Ubuntu 22.04 bringt eine Gruppe „admin“ mit; heißt der Gast-Benutzer so, brach useradd mit Code 9 ab (gefunden im Feldtest auf pve-demo). Der Container-Test legt jetzt diese Lage nach und lief seit pnpm 12 nicht mehr (pnpm -s gibt es dort nicht).

Refs #020

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:08:05 +02:00

29 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Führt die Profile base, docker und zabbix-agent wirklich aus: je ein frischer Container pro
# Distribution, danach Prüfung des Ergebnisses und ein zweiter Lauf (Idempotenz).
# Dauert einige Minuten und braucht Docker und Netz – deshalb nicht im Commit-Tor.
# pnpm test:container # alle
# pnpm test:container debian-13 # eine
set -euo pipefail
cd "$(dirname "$0")/../.."
export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
declare -A IMAGES=(
[debian-12]=debian:bookworm-slim [debian-13]=debian:trixie-slim
[ubuntu-22.04]=ubuntu:22.04 [ubuntu-24.04]=ubuntu:24.04 [ubuntu-26.04]=ubuntu:26.04
)
ziele=("${@:-debian-12 debian-13 ubuntu-22.04 ubuntu-24.04 ubuntu-26.04}")
arbeit="$(mktemp -d)"; trap 'rm -rf "$arbeit"' EXIT
cp tests/container/im-gast-pruefen.sh "$arbeit/"
fehler=0
for distro in ${ziele[*]}; do
PD_BENUTZER=admin pnpm exec tsx scripts/profil-rendern.ts "$distro" docker,zabbix-agent server=zbx.example fail2ban=true > "$arbeit/$distro.sh"
echo "=== $distro (${IMAGES[$distro]})"
if docker run --rm -v "$arbeit:/s:ro" "${IMAGES[$distro]}" bash /s/im-gast-pruefen.sh "/s/$distro.sh" > "$arbeit/$distro.log" 2>&1 \
&& grep -q '^exit=0$' "$arbeit/$distro.log" && grep -q '^exit2=0$' "$arbeit/$distro.log"; then
echo "✓ $distro"
else
echo "✗ $distro"; tail -30 "$arbeit/$distro.log"; fehler=1
fi
done
exit $fehler