2022-01-20 23:09:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# go to script root directory
|
|
|
|
cd "$(dirname "$0")" || exit 1
|
|
|
|
|
|
|
|
down() {
|
2024-02-03 22:32:17 +00:00
|
|
|
docker compose -f "$1" down -v --remove-orphans
|
2022-01-20 23:09:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# tests to completely spin up Minecraft and use the monitor to validate the service is running.
|
|
|
|
fullMinecraftUpTest(){
|
2024-02-03 22:32:17 +00:00
|
|
|
file="$1"
|
2022-01-20 23:09:34 +00:00
|
|
|
failed=false
|
|
|
|
# run the monitor to validate the Minecraft image is healthy
|
2024-02-03 22:32:17 +00:00
|
|
|
docker compose -f "$file" run monitor || failed=true
|
|
|
|
echo "$(dirname "$file") Result: failed=$failed"
|
|
|
|
if $failed; then
|
|
|
|
docker compose logs mc
|
|
|
|
down "$file"
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
down "$file"
|
|
|
|
fi
|
2022-01-20 23:09:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# go through each folder in fulltests and run fullbuilds
|
2024-02-03 22:32:17 +00:00
|
|
|
files=$(ls */docker-compose.yml)
|
|
|
|
for file in $files; do
|
|
|
|
|
|
|
|
echo "Starting Tests on $(dirname "$file")"
|
|
|
|
if ! fullMinecraftUpTest "$file"; then
|
|
|
|
exit 2
|
2022-01-20 23:09:34 +00:00
|
|
|
fi
|
2024-02-03 22:32:17 +00:00
|
|
|
|
2022-01-20 23:09:34 +00:00
|
|
|
done
|