Skip to content

Commit cae200e

Browse files
hyperpolymathclaude
andcommitted
fix: e2e test matches VeriSimDB API routes and response format
- Use /octads, /search/text, /drift/status (not /api/v1/ prefix) - Use flat JSON input (title, body, types) not nested sub-structs - Fix bash arithmetic with set -e (avoid (( )) falsy-zero trap) - Match response format: check ID in GET, title in search - Health check matches "healthy" not "ok" - Add GSA_PROBE_TARGET env var for game server target - All 8 tests pass against live VeriSimDB on port 8090 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 65cee87 commit cae200e

1 file changed

Lines changed: 20 additions & 63 deletions

File tree

scripts/e2e-test.sh

Lines changed: 20 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
set -euo pipefail
2525

2626
VERISIMDB_URL="${GSA_VERISIMDB_URL:-http://[::1]:8090}"
27-
TARGET_SERVER="${1:-}"
27+
TARGET_SERVER="${1:-${GSA_PROBE_TARGET:-}}"
2828
PASSED=0
2929
FAILED=0
3030
TOTAL=0
3131

3232
# ── Helpers ──────────────────────────────────────────────────────────
3333

34-
pass() { ((PASSED++)); ((TOTAL++)); echo " PASS: $1"; }
35-
fail() { ((FAILED++)); ((TOTAL++)); echo " FAIL: $1"; }
34+
pass() { PASSED=$((PASSED + 1)); TOTAL=$((TOTAL + 1)); echo " PASS: $1"; }
35+
fail() { FAILED=$((FAILED + 1)); TOTAL=$((TOTAL + 1)); echo " FAIL: $1"; }
3636

3737
check() {
3838
local desc="$1"
@@ -69,7 +69,7 @@ echo ""
6969

7070
echo "Step 1: VeriSimDB health check"
7171
check "VeriSimDB is reachable" curl -sf "${VERISIMDB_URL}/health"
72-
check_output "VeriSimDB returns ok" "ok" curl -sf "${VERISIMDB_URL}/health"
72+
check_output "VeriSimDB returns healthy" "healthy" curl -sf "${VERISIMDB_URL}/health"
7373

7474
if [[ $FAILED -gt 0 ]]; then
7575
echo ""
@@ -86,44 +86,15 @@ echo "Step 2: Create test octad"
8686

8787
TEST_OCTAD=$(cat <<'JSON'
8888
{
89-
"document": {
90-
"title": "e2e-test-server",
91-
"body": "Minecraft Java Edition test server for GSA e2e validation. Running version 1.21.4 with max-players=32 and difficulty=normal.",
92-
"fields": {"game_id": "minecraft-java", "test": "true"}
93-
},
94-
"semantic": {
95-
"types": ["https://gsa.hyperpolymath.dev/types/GameServer", "https://gsa.hyperpolymath.dev/types/GameServer/Minecraft"],
96-
"properties": {}
97-
},
98-
"graph": {
99-
"relationships": [["has-profile", "profile:minecraft-java"], ["in-cluster", "cluster:e2e-test"]]
100-
},
101-
"vector": {
102-
"embedding": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
103-
"model": "test-8dim"
104-
},
105-
"provenance": {
106-
"event_type": "created",
107-
"actor": "gsa-e2e-test",
108-
"description": "Created by e2e integration test"
109-
},
110-
"spatial": {
111-
"latitude": 51.5074,
112-
"longitude": -0.1278,
113-
"altitude": 0.0
114-
},
115-
"metadata": {
116-
"game_id": "minecraft-java",
117-
"host": "127.0.0.1",
118-
"port": "25565",
119-
"protocol": "minecraft-query",
120-
"status": "test"
121-
}
89+
"title": "e2e-test-server",
90+
"body": "Minecraft Java Edition test server for GSA e2e validation. Running version 1.21.4 with max-players=32 and difficulty=normal.",
91+
"types": ["https://gsa.hyperpolymath.dev/types/GameServer", "https://gsa.hyperpolymath.dev/types/GameServer/Minecraft"],
92+
"relationships": [["has-profile", "profile:minecraft-java"], ["in-cluster", "cluster:e2e-test"]]
12293
}
12394
JSON
12495
)
12596

126-
CREATE_RESPONSE=$(curl -sf -X POST "${VERISIMDB_URL}/api/v1/octads" \
97+
CREATE_RESPONSE=$(curl -sf -X POST "${VERISIMDB_URL}/octads" \
12798
-H "Content-Type: application/json" \
12899
-d "$TEST_OCTAD" 2>/dev/null) || { fail "Create octad (HTTP error)"; CREATE_RESPONSE=""; }
129100

@@ -151,23 +122,23 @@ echo ""
151122
echo "Step 3: Query octad back"
152123

153124
if [[ "$OCTAD_ID" != "e2e-test-fallback" ]]; then
154-
check_output "GET octad by ID" "e2e-test-server" \
155-
curl -sf "${VERISIMDB_URL}/api/v1/octads/${OCTAD_ID}"
125+
check_output "GET octad by ID" "$OCTAD_ID" \
126+
curl -sf "${VERISIMDB_URL}/octads/${OCTAD_ID}"
156127
fi
157128

158-
check_output "Text search for 'minecraft'" "minecraft" \
159-
curl -sf "${VERISIMDB_URL}/api/v1/search/text?q=minecraft&limit=5"
129+
check_output "Text search for 'e2e-test'" "e2e-test" \
130+
curl -sf "${VERISIMDB_URL}/search/text?q=e2e-test&limit=5"
160131

161132
# ── Step 4: Drift Detection ──────────────────────────────────────────
162133

163134
echo ""
164135
echo "Step 4: Drift detection"
165136

166-
check "Drift status endpoint responds" curl -sf "${VERISIMDB_URL}/api/v1/drift/status"
137+
check "Drift status endpoint responds" curl -sf "${VERISIMDB_URL}/drift/status"
167138

168139
if [[ "$OCTAD_ID" != "e2e-test-fallback" ]]; then
169140
# Entity-level drift check
170-
DRIFT_RESPONSE=$(curl -sf "${VERISIMDB_URL}/api/v1/drift/entity/${OCTAD_ID}" 2>/dev/null) || true
141+
DRIFT_RESPONSE=$(curl -sf "${VERISIMDB_URL}/drift/entity/${OCTAD_ID}" 2>/dev/null) || true
171142
if [[ -n "$DRIFT_RESPONSE" ]]; then
172143
pass "Entity drift check (id=$OCTAD_ID)"
173144
else
@@ -210,27 +181,13 @@ if [[ -n "$TARGET_SERVER" ]]; then
210181
# Store probe result as octad
211182
PROBE_OCTAD=$(cat <<PROBEJSON
212183
{
213-
"document": {
214-
"title": "probe-${host}-${port}",
215-
"body": "Live probe result for ${host}:${port} from GSA e2e test",
216-
"fields": {"probe": "true", "host": "$host", "port": "$port"}
217-
},
218-
"metadata": {
219-
"game_id": "unknown",
220-
"host": "$host",
221-
"port": "$port",
222-
"protocol": "tcp-connect",
223-
"status": "reachable"
224-
},
225-
"provenance": {
226-
"event_type": "probed",
227-
"actor": "gsa-e2e-test",
228-
"description": "Live TCP probe from e2e test"
229-
}
184+
"title": "probe-${host}-${port}",
185+
"body": "Live probe result for ${host}:${port} from GSA e2e test. Protocol: tcp-connect. Status: reachable.",
186+
"types": ["https://gsa.hyperpolymath.dev/types/ProbeResult"]
230187
}
231188
PROBEJSON
232189
)
233-
PROBE_RESPONSE=$(curl -sf -X POST "${VERISIMDB_URL}/api/v1/octads" \
190+
PROBE_RESPONSE=$(curl -sf -X POST "${VERISIMDB_URL}/octads" \
234191
-H "Content-Type: application/json" \
235192
-d "$PROBE_OCTAD" 2>/dev/null) || true
236193

@@ -253,7 +210,7 @@ echo ""
253210
echo "Step 6: Cleanup"
254211

255212
if [[ "$OCTAD_ID" != "e2e-test-fallback" ]]; then
256-
check "Delete test octad" curl -sf -X DELETE "${VERISIMDB_URL}/api/v1/octads/${OCTAD_ID}"
213+
check "Delete test octad" curl -sf -X DELETE "${VERISIMDB_URL}/octads/${OCTAD_ID}"
257214
fi
258215

259216
# ── Summary ──────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)