diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/check.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/check.sh b/tests/check.sh index a19b55e..e0c9bed 100755 --- a/tests/check.sh +++ b/tests/check.sh @@ -85,6 +85,32 @@ EOF ) echo "" +echo "=== hetzner-admin: SERVICES が run-command.sh / status/targets.txt と一致するか ===" +admin_services=$(python3 - <<'EOF' +import ast +tree = ast.parse(open("hetzner-admin/app.py").read()) +for node in ast.walk(tree): + if isinstance(node, ast.Assign) and getattr(node.targets[0], "id", "") == "SERVICES": + print(" ".join(e.value for e in node.value.elts)) +EOF +) +script_services=$(sed -n 's/^SERVICES="\(.*\)"$/\1/p' hetzner-admin/run-command.sh) +if [[ "$admin_services" == "$script_services" ]]; then + ok "app.py と run-command.sh の SERVICES が一致" +else + ng "SERVICES 不一致: app.py=[$admin_services] run-command.sh=[$script_services]" +fi +for name in $admin_services; do + if ! grep -qE "^ +$name\) " hetzner-admin/run-command.sh; then + ng "run-command.sh の service_compose に $name がない" + elif ! grep -qE "^$name\s" status/targets.txt; then + ng "status/targets.txt に $name がない(ステータスページと連動しない)" + else + ok "service: $name" + fi +done + +echo "" echo "=== 秘密ファイルがコミットされていないか ===" for name in users.conf id_rsa id_rsa.pub .env; do regex="(^|/)$(printf '%s' "$name" | sed 's/\./\\./g')\$" |
