-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun-local-test.sh
More file actions
executable file
·107 lines (87 loc) · 3 KB
/
run-local-test.sh
File metadata and controls
executable file
·107 lines (87 loc) · 3 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
set -e
echo "=========================================="
echo "Local Penpot MCP Server Test"
echo "=========================================="
echo ""
# Cleanup function
cleanup() {
echo ""
echo "🧹 Cleaning up..."
docker compose -f docker-compose.penpot.yml down -v
echo "✅ Cleanup complete"
}
# Register cleanup on exit
trap cleanup EXIT
# Step 1: Create test-results directory
echo "📁 Creating test-results directory..."
mkdir -p test-results
# Step 2: Start Penpot stack
echo ""
echo "🚀 Starting Penpot stack..."
docker compose -f docker-compose.penpot.yml up -d
echo "✅ Penpot services started"
# Step 3: Wait for Penpot to be healthy
echo ""
echo "⏳ Waiting for Penpot services to be healthy..."
timeout 300 bash -c '
while true; do
BACKEND_HEALTH=$(docker inspect penpot-backend --format="{{.State.Health.Status}}" 2>/dev/null || echo "starting")
POSTGRES_HEALTH=$(docker inspect penpot-postgres --format="{{.State.Health.Status}}" 2>/dev/null || echo "starting")
REDIS_HEALTH=$(docker inspect penpot-redis --format="{{.State.Health.Status}}" 2>/dev/null || echo "starting")
echo "Backend: $BACKEND_HEALTH, Postgres: $POSTGRES_HEALTH, Redis: $REDIS_HEALTH"
if [ "$POSTGRES_HEALTH" = "healthy" ] && [ "$REDIS_HEALTH" = "healthy" ]; then
echo "✅ Core services are healthy!"
break
fi
sleep 5
done
'
# Additional wait for backend to be fully ready
echo ""
echo "⏳ Waiting for backend to be fully ready..."
timeout 300 bash -c '
until docker logs penpot-backend 2>&1 | grep -q "welcome to penpot"; do
echo "Waiting for backend to complete startup..."
sleep 5
done
'
echo "✅ All services are ready!"
# Step 4: Show service status
echo ""
echo "📋 Service status:"
docker compose -f docker-compose.penpot.yml ps
# Step 5: Setup test user and generate token
echo ""
echo "👤 Setting up test user and generating access token..."
docker compose -f docker-compose.penpot.yml --profile setup up --abort-on-container-exit penpot-setup
if [ ! -f test-results/access-token.txt ]; then
echo "❌ Setup failed - no access token generated"
echo ""
echo "📋 Setup logs:"
docker compose -f docker-compose.penpot.yml logs penpot-setup
exit 1
fi
echo "✅ Test user created and token generated"
echo "Token: $(head -c 20 test-results/access-token.txt)..."
# Step 6: Show setup logs
echo ""
echo "📋 Setup logs:"
docker compose -f docker-compose.penpot.yml logs penpot-setup
# Step 7: Run MCP server tests
echo ""
echo "🧪 Running MCP server tests..."
docker compose -f docker-compose.penpot.yml --profile test up --abort-on-container-exit penpot-mcp-test
TEST_EXIT_CODE=$?
echo "Test exit code: $TEST_EXIT_CODE"
# Step 8: Show test logs
echo ""
echo "📋 Test logs:"
docker compose -f docker-compose.penpot.yml logs penpot-mcp-test
if [ $TEST_EXIT_CODE -ne 0 ]; then
echo ""
echo "❌ Tests failed"
exit $TEST_EXIT_CODE
fi
echo ""
echo "✅ All tests passed!"