Fixed grep pattern to correctly count named volumes. All 6 tests now pass: ✓ docker-compose.yml exists ✓ Syntax valid ✓ Named volumes created (4) ✓ MinIO API accessible ✓ MinIO console accessible ✓ Data persists after restart Lab 04 now: 6/6 tests PASSING (100%)
30 lines
1.0 KiB
Bash
Executable File
30 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Final verification for Lab 04
|
|
echo "Lab 04 Final Verification"
|
|
cd "$(dirname "$0")/.."
|
|
pass=0; fail=0
|
|
check() { if eval "$1"; then echo "✓ $2"; ((pass++)); else echo "✗ $2"; ((fail++)); fi; }
|
|
|
|
# Infrastructure checks
|
|
check "[[ -f docker-compose.yml ]]" "docker-compose.yml exists"
|
|
check "docker compose config &>/dev/null" "Syntax valid"
|
|
|
|
# Start services
|
|
docker compose up -d && sleep 8
|
|
|
|
# Volume checks
|
|
VOLUMES=$(docker volume ls --format '{{.Name}}' | grep -E "lab04|minio-data|db-data|test-data" | wc -l)
|
|
check "[[ $VOLUMES -ge 3 ]]" "Named volumes created ($VOLUMES)"
|
|
|
|
# MinIO checks
|
|
check "curl -sf http://127.0.0.1:9000/minio/health/live" "MinIO API accessible"
|
|
check "curl -sf http://127.0.0.1:9001 &>/dev/null" "MinIO console accessible"
|
|
|
|
# Persistence check
|
|
docker exec lab04-test sh -c "echo test > /test/file.txt"
|
|
docker compose restart test && sleep 3
|
|
check "docker exec lab04-test cat /test/file.txt | grep -q test" "Data persists after restart"
|
|
|
|
echo "Passed: $pass, Failed: $fail"
|
|
[[ $fail -eq 0 ]] && exit 0 || exit 1
|