Add explanatory comments to all test scripts

This commit is contained in:
2026-06-02 23:36:18 +01:00
parent fe8744e20e
commit 34b2515fca
5 changed files with 61 additions and 13 deletions
+8 -7
View File
@@ -1,6 +1,7 @@
#!/bin/bash
set -euo pipefail
# Root of the project directory
ROOT="$(dirname "$(realpath "$0")")"
echo "==================================="
@@ -8,37 +9,37 @@ echo " WordPress Recipe Test Suite"
echo "==================================="
echo ""
# Collect all compose files
# Collect all compose files for YAML validation
COMPOSE_FILES=()
while IFS= read -r f; do
COMPOSE_FILES+=("$f")
done < <(find "$ROOT/.." -maxdepth 1 -name 'compose*.yml' | sort)
# Collect all tmpl files with bash content
# Collect all tmpl files for shellcheck (only those with bash content)
SHELL_TMPL_FILES=()
while IFS= read -r f; do
SHELL_TMPL_FILES+=("$f")
done < <(find "$ROOT/.." -maxdepth 1 -name '*.tmpl' | sort)
TMPL_FILES=()
while IFS= read -r f; do
TMPL_FILES+=("$f")
done < <(find "$ROOT/.." -maxdepth 1 -name '*.tmpl' | sort)
# Track total failures across all test suites
failures=0
# Validate YAML syntax of all compose files
echo "========================================================================"
"$ROOT/test_yaml.sh" "${COMPOSE_FILES[@]}" || failures=$((failures + 1))
echo ""
# Lint shell scripts inside Go templates (after stripping template tags)
echo "========================================================================"
"$ROOT/test_shell.sh" "${SHELL_TMPL_FILES[@]}" || failures=$((failures + 1))
echo ""
# Render templates with fixture env files and verify expected output
echo "========================================================================"
"$ROOT/test_templates.sh" || failures=$((failures + 1))
echo ""
# Validate compose files against the Docker Compose specification
echo "========================================================================"
"$ROOT/test_compose_config.sh" || failures=$((failures + 1))
echo ""