Compost / test.sh
abc1181's picture
Add dynamic auth configs, connect page, Next.js frontend
7657e9f
Raw
History Blame Contribute Delete
1.61 kB
#!/bin/bash
# Test script for Platform
# Run this after building the Docker container
set -e
echo "========================================="
echo " Platform - Test Suite"
echo "========================================="
PLATFORM_URL="${PLATFORM_URL:-http://localhost:7860}"
PASS=0
FAIL=0
test_endpoint() {
local name=$1
local path=$2
local expected_status=$3
status=$(curl -s -o /dev/null -w "%{http_code}" "$PLATFORM_URL$path" 2>/dev/null || echo "000")
if [ "$status" = "$expected_status" ]; then
echo "[PASS] $name - $path ($status)"
PASS=$((PASS + 1))
else
echo "[FAIL] $name - $path (expected $expected_status, got $status)"
FAIL=$((FAIL + 1))
fi
}
echo ""
echo "Testing endpoints at $PLATFORM_URL..."
echo ""
# Health check
test_endpoint "Health" "/health" "200"
# API docs
test_endpoint "API Docs" "/api/docs" "200"
# Auth endpoints
test_endpoint "Auth Register" "/api/auth/register" "422"
test_endpoint "Auth Login" "/api/auth/login" "405"
# Apps endpoints (should return empty list without auth)
test_endpoint "Apps List" "/api/apps" "200"
# Settings
test_endpoint "Settings" "/api/settings" "200"
test_endpoint "Health Check" "/api/settings/health" "200"
# MCP endpoints
test_endpoint "MCP Discovery" "/mcp/v1/discovery" "200"
test_endpoint "MCP Tools" "/mcp/v1/tools" "200"
# Static files
test_endpoint "Frontend SPA" "/" "200"
echo ""
echo "========================================="
echo " Results: $PASS passed, $FAIL failed"
echo "========================================="
if [ $FAIL -gt 0 ]; then
exit 1
fi