-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-service-api.sh
More file actions
executable file
·40 lines (33 loc) · 998 Bytes
/
test-service-api.sh
File metadata and controls
executable file
·40 lines (33 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
SPRITE_NAME="${1:-simple-test}"
if [ -z "$SPRITE_TOKEN" ]; then
echo "❌ SPRITE_TOKEN not set"
exit 1
fi
echo "Testing Services API directly"
echo "=============================="
echo ""
echo "1️⃣ Create service with minimal config:"
curl -X PUT \
-H "Authorization: Bearer $SPRITE_TOKEN" \
-H "Content-Type: application/json" \
"https://api.sprites.dev/v1/sprites/$SPRITE_NAME/services/test-http" \
-d '{
"cmd": "sh",
"args": ["-c", "cd /app && PORT=8080 bun run app.ts"],
"http_port": 8080,
"needs": []
}' | jq .
echo ""
echo "2️⃣ Start the service and watch logs:"
curl -X POST \
-H "Authorization: Bearer $SPRITE_TOKEN" \
"https://api.sprites.dev/v1/sprites/$SPRITE_NAME/services/test-http/start?duration=10s" \
-N
echo ""
echo "3️⃣ Check service status:"
curl -s -H "Authorization: Bearer $SPRITE_TOKEN" \
"https://api.sprites.dev/v1/sprites/$SPRITE_NAME/services/test-http" | jq .
echo ""
echo "✅ Test complete"