Added basic tests
This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(dirname "$(realpath "$0")")"
|
||||
|
||||
echo "==================================="
|
||||
echo " WordPress Recipe Test Suite"
|
||||
echo "==================================="
|
||||
echo ""
|
||||
|
||||
# Collect all compose files
|
||||
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
|
||||
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)
|
||||
|
||||
failures=0
|
||||
|
||||
echo "========================================================================"
|
||||
"$ROOT/test_yaml.sh" "${COMPOSE_FILES[@]}" || failures=$((failures + 1))
|
||||
echo ""
|
||||
|
||||
echo "========================================================================"
|
||||
"$ROOT/test_shell.sh" "${SHELL_TMPL_FILES[@]}" || failures=$((failures + 1))
|
||||
echo ""
|
||||
|
||||
echo "========================================================================"
|
||||
"$ROOT/test_templates.sh" || failures=$((failures + 1))
|
||||
echo ""
|
||||
|
||||
echo "==================================="
|
||||
if [ "$failures" -eq 0 ]; then
|
||||
echo " All tests passed!"
|
||||
else
|
||||
echo " $failures test suite(s) failed"
|
||||
fi
|
||||
echo "==================================="
|
||||
exit "$failures"
|
||||
Reference in New Issue
Block a user