- Remove production_test_sequence.sh (DAW-specific production tests) - Remove setup_env.sh (obsolete .env setup, replaced by furt.conf) - Sanitize test scripts: replace dragons-at-work.de with example.com - Sanitize API keys: replace dev keys with placeholder values - Remove hardcoded DAW fallbacks from http_server.lua and smtp.lua - Update .gitignore to exclude production-specific test files Tests remain functional for developers with example domains. All internal DAW infrastructure details removed from package. Closes #101
61 lines
1.9 KiB
Bash
Executable file
61 lines
1.9 KiB
Bash
Executable file
#!/bin/bash
|
||
# furt-lua/scripts/test_modular.sh
|
||
# Test der modularen Furt-Architektur
|
||
|
||
BASE_URL="http://127.0.0.1:8080"
|
||
HUGO_API_KEY="YOUR_API_KEY_HERE"
|
||
|
||
echo "🧩 Testing Modular Furt Architecture"
|
||
echo "===================================="
|
||
|
||
# Test 1: Module dependencies check
|
||
echo -e "\n1️⃣ Testing module imports (should not error on startup):"
|
||
echo "Starting server in background..."
|
||
cd "$(dirname "$0")/.."
|
||
lua src/main.lua &
|
||
SERVER_PID=$!
|
||
sleep 2
|
||
|
||
if kill -0 $SERVER_PID 2>/dev/null; then
|
||
echo "✅ Server started successfully - all modules loaded"
|
||
else
|
||
echo "❌ Server failed to start - module import error"
|
||
exit 1
|
||
fi
|
||
|
||
# Test 2: Public endpoints (no auth)
|
||
echo -e "\n2️⃣ Testing public endpoints:"
|
||
curl -s -w "Status: %{http_code}\n" "$BASE_URL/health" | jq '.features'
|
||
|
||
# Test 3: Protected endpoints without auth (should fail)
|
||
echo -e "\n3️⃣ Testing auth protection:"
|
||
curl -s -w "Status: %{http_code}\n" \
|
||
-X POST \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"name":"Test","email":"test@example.com","message":"Test"}' \
|
||
"$BASE_URL/v1/mail/send" | jq '.error'
|
||
|
||
# Test 4: Protected endpoints with auth (should work)
|
||
echo -e "\n4️⃣ Testing authenticated request:"
|
||
curl -s -w "Status: %{http_code}\n" \
|
||
-H "X-API-Key: $HUGO_API_KEY" \
|
||
"$BASE_URL/v1/auth/status" | jq '.'
|
||
|
||
# Test 5: Rate limiting headers
|
||
echo -e "\n5️⃣ Testing rate limit headers:"
|
||
curl -s -i -H "X-API-Key: $HUGO_API_KEY" "$BASE_URL/v1/auth/status" | grep -E "X-RateLimit|HTTP"
|
||
|
||
# Cleanup
|
||
echo -e "\n🧹 Cleanup:"
|
||
kill $SERVER_PID 2>/dev/null
|
||
wait $SERVER_PID 2>/dev/null
|
||
echo "Server stopped"
|
||
|
||
echo -e "\n✅ Modular Architecture Test Complete!"
|
||
echo "Expected behavior:"
|
||
echo "- Test 1: ✅ Server starts without module errors"
|
||
echo "- Test 2: ✅ Health endpoint works, shows features"
|
||
echo "- Test 3: ❌ 401 Unauthorized (missing API key)"
|
||
echo "- Test 4: ✅ 200 OK with auth details"
|
||
echo "- Test 5: ✅ Rate limit headers present"
|
||
|