54 lines
1007 B
Bash
Executable File
54 lines
1007 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# run_all_tests.sh — simple runner for test_api.sh
|
|
#
|
|
|
|
API_SCRIPT="./test_api.sh"
|
|
|
|
# Make sure test_api.sh is executable
|
|
if [ ! -x "$API_SCRIPT" ]; then
|
|
echo "Error: $API_SCRIPT not found or not executable"
|
|
exit 1
|
|
fi
|
|
|
|
# List of tests to run (must match functions in test_api.sh)
|
|
TESTS=(
|
|
root_redirect
|
|
update_container
|
|
start_container
|
|
stop_container
|
|
nuke_container
|
|
info_all
|
|
info_one
|
|
bump_container
|
|
container_quota
|
|
system_containers
|
|
system_images
|
|
system_info
|
|
system_pull
|
|
)
|
|
|
|
ok_count=0
|
|
fail_count=0
|
|
|
|
echo "Running API tests..."
|
|
echo "===================="
|
|
|
|
for test in "${TESTS[@]}"; do
|
|
# Run test, capture HTTP status code only
|
|
status=$($API_SCRIPT $test -s -o /dev/null -w "%{http_code}")
|
|
|
|
if [[ "$status" == "200" || "$status" == "302" ]]; then
|
|
echo "[OK ] $test"
|
|
((ok_count++))
|
|
else
|
|
echo "[NOK] $test (HTTP $status)"
|
|
((fail_count++))
|
|
fi
|
|
done
|
|
|
|
echo "===================="
|
|
echo "Summary: $ok_count OK, $fail_count NOK"
|
|
exit $fail_count
|
|
|