Spaces:
Sleeping
Sleeping
Vu Minh Chien
commited on
Commit
·
5a5589e
1
Parent(s):
a22621a
Add test script for deployed server
Browse files- test-server.sh +69 -0
test-server.sh
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Test script for Hugging Face Space deployment
|
| 4 |
+
SERVER_URL="https://detomo-houzou-notification-server.hf.space"
|
| 5 |
+
|
| 6 |
+
echo "🧪 Testing Houzou Medical Notification Server"
|
| 7 |
+
echo "Server URL: $SERVER_URL"
|
| 8 |
+
echo "========================================="
|
| 9 |
+
|
| 10 |
+
# Test 1: Health check
|
| 11 |
+
echo "1. Health Check:"
|
| 12 |
+
curl -s "$SERVER_URL" | jq '.' 2>/dev/null || curl -s "$SERVER_URL"
|
| 13 |
+
echo -e "\n"
|
| 14 |
+
|
| 15 |
+
# Test 2: Test Firebase connectivity
|
| 16 |
+
echo "2. Firebase Test:"
|
| 17 |
+
curl -s "$SERVER_URL/test-firebase" | jq '.' 2>/dev/null || curl -s "$SERVER_URL/test-firebase"
|
| 18 |
+
echo -e "\n"
|
| 19 |
+
|
| 20 |
+
# Test 3: Check devices
|
| 21 |
+
echo "3. Registered Devices:"
|
| 22 |
+
curl -s "$SERVER_URL/devices" | jq '.' 2>/dev/null || curl -s "$SERVER_URL/devices"
|
| 23 |
+
echo -e "\n"
|
| 24 |
+
|
| 25 |
+
# Test 4: Register test device
|
| 26 |
+
echo "4. Register Test Device:"
|
| 27 |
+
curl -s -X POST "$SERVER_URL/register-token" \
|
| 28 |
+
-H "Content-Type: application/json" \
|
| 29 |
+
-d '{
|
| 30 |
+
"token": "test-token-123",
|
| 31 |
+
"deviceId": "test-device-123",
|
| 32 |
+
"platform": "test",
|
| 33 |
+
"appVersion": "1.0.0"
|
| 34 |
+
}' | jq '.' 2>/dev/null || curl -s -X POST "$SERVER_URL/register-token" \
|
| 35 |
+
-H "Content-Type: application/json" \
|
| 36 |
+
-d '{
|
| 37 |
+
"token": "test-token-123",
|
| 38 |
+
"deviceId": "test-device-123",
|
| 39 |
+
"platform": "test",
|
| 40 |
+
"appVersion": "1.0.0"
|
| 41 |
+
}'
|
| 42 |
+
echo -e "\n"
|
| 43 |
+
|
| 44 |
+
# Test 5: Check devices again
|
| 45 |
+
echo "5. Devices After Registration:"
|
| 46 |
+
curl -s "$SERVER_URL/devices" | jq '.' 2>/dev/null || curl -s "$SERVER_URL/devices"
|
| 47 |
+
echo -e "\n"
|
| 48 |
+
|
| 49 |
+
# Test 6: Send test notification
|
| 50 |
+
echo "6. Test Broadcast Notification:"
|
| 51 |
+
curl -s -X POST "$SERVER_URL/send-broadcast-notification" \
|
| 52 |
+
-H "Content-Type: application/json" \
|
| 53 |
+
-d '{
|
| 54 |
+
"title": "🧪 Test Notification",
|
| 55 |
+
"body": "This is a test from deployment script",
|
| 56 |
+
"type": "home"
|
| 57 |
+
}' | jq '.' 2>/dev/null || curl -s -X POST "$SERVER_URL/send-broadcast-notification" \
|
| 58 |
+
-H "Content-Type: application/json" \
|
| 59 |
+
-d '{
|
| 60 |
+
"title": "🧪 Test Notification",
|
| 61 |
+
"body": "This is a test from deployment script",
|
| 62 |
+
"type": "home"
|
| 63 |
+
}'
|
| 64 |
+
echo -e "\n"
|
| 65 |
+
|
| 66 |
+
echo "========================================="
|
| 67 |
+
echo "✅ Testing completed!"
|
| 68 |
+
echo "💡 Note: Notification send may fail with test tokens (expected)"
|
| 69 |
+
echo "🔄 Server is using in-memory storage, devices will reset on restart"
|