-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_server.sh
More file actions
43 lines (33 loc) · 952 Bytes
/
test_server.sh
File metadata and controls
43 lines (33 loc) · 952 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
41
42
#!/bin/bash
# Test script for Guardian Agent (Rust)
set -e
echo "Testing Guardian Agent (Rust)..."
# Start server in background
echo "Starting server..."
./target/release/guardian-server &
SERVER_PID=$!
# Wait for server to start
sleep 2
# Test health endpoint
echo "Testing health endpoint..."
curl -s http://localhost:8080/health | jq . || echo "Health check failed"
# Test validation endpoint
echo "Testing validation endpoint..."
curl -s -X POST http://localhost:8080/validate \
-H "Content-Type: application/json" \
-d '{
"action": {
"type": "file_write",
"resource": "/tmp/test.txt"
},
"context": {
"user_id": "test_user"
}
}' | jq . || echo "Validation failed"
# Test metrics endpoint
echo "Testing metrics endpoint..."
curl -s http://localhost:8080/metrics | head -20 || echo "Metrics failed"
# Stop server
echo "Stopping server..."
kill $SERVER_PID 2>/dev/null || true
echo "Tests completed!"