-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-setup.sh
More file actions
executable file
·68 lines (57 loc) · 2.01 KB
/
verify-setup.sh
File metadata and controls
executable file
·68 lines (57 loc) · 2.01 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
#!/bin/bash
set -e
echo "=== Lab Automation System - Setup Verification ==="
echo ""
PASS=0
FAIL=0
check() {
if eval "$2" > /dev/null 2>&1; then
echo " ✓ $1"
PASS=$((PASS + 1))
else
echo " ✗ $1"
FAIL=$((FAIL + 1))
fi
}
echo "Checking prerequisites..."
check "Docker is installed" "command -v docker"
check "Docker Compose is available" "docker compose version"
check "Docker daemon is running" "docker info"
echo ""
echo "Checking project files..."
check "docker-compose.yml exists" "test -f docker-compose.yml"
check "Device service app.py exists" "test -f services/device-service/app.py"
check "Workflow service app.py exists" "test -f services/workflow-service/app.py"
check "Database init script exists" "test -f db/init.sql"
echo ""
echo "Checking services are running..."
check "Device service responds" "curl -sf http://localhost:5001/health"
check "Workflow service responds" "curl -sf http://localhost:5002/health"
echo ""
echo "Checking intentional bugs are present..."
# Bug 1: Missing DEVICE_SERVICE_URL
if ! grep -q "DEVICE_SERVICE_URL" docker-compose.yml; then
echo " ✓ Bug 1 present: DEVICE_SERVICE_URL missing from docker-compose.yml"
PASS=$((PASS + 1))
else
echo " ✗ Bug 1 may be fixed: DEVICE_SERVICE_URL found in docker-compose.yml"
FAIL=$((FAIL + 1))
fi
# Bug 2: Wrong endpoint path
if grep -q "/device/" services/workflow-service/app.py && grep -q "/reserve" services/workflow-service/app.py; then
echo " ✓ Bug 2 present: Wrong device endpoint path in workflow service"
PASS=$((PASS + 1))
else
echo " ✗ Bug 2 may be fixed: Endpoint path may have been corrected"
FAIL=$((FAIL + 1))
fi
# Bug 3: Race condition
if grep -q "time.sleep(0.1)" services/device-service/app.py; then
echo " ✓ Bug 3 present: Race condition window in device booking"
PASS=$((PASS + 1))
else
echo " ✗ Bug 3 may be fixed: Sleep removed from booking endpoint"
FAIL=$((FAIL + 1))
fi
echo ""
echo "=== Results: $PASS passed, $FAIL failed ==="