Skip to content

Commit 0170703

Browse files
committed
feat(ci): add full integration test with auth, route creation, and webhook validation
1 parent 63a2dda commit 0170703

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,16 @@ jobs:
315315
RESP=$(curl -s -X POST http://localhost:3001/auth/login \
316316
-H "Content-Type: application/json" \
317317
-d '{"email":"ci@hooktrace.test","password":"ci_test_pass"}')
318+
318319
echo "Login response: $RESP"
320+
319321
TOKEN=$(echo $RESP | python3 -c "import sys,json; print(json.load(sys.stdin).get('access_token',''))")
322+
323+
if [ -z "$TOKEN" ]; then
324+
echo " Login failed"
325+
exit 1
326+
fi
327+
320328
echo "TOKEN=$TOKEN" >> $GITHUB_ENV
321329
322330
- name: Create a route
@@ -325,22 +333,34 @@ jobs:
325333
-H "Content-Type: application/json" \
326334
-H "Authorization: Bearer $TOKEN" \
327335
-d '{"name":"ci-test-route"}')
336+
328337
echo "Create route response: $RESP"
338+
329339
ROUTE_TOKEN=$(echo $RESP | python3 -c "import sys,json; print(json.load(sys.stdin).get('token',''))")
330340
ROUTE_PATH=$(echo $RESP | python3 -c "import sys,json; print(json.load(sys.stdin).get('route','ci'))")
341+
342+
if [ -z "$ROUTE_TOKEN" ]; then
343+
echo " Failed to create route"
344+
exit 1
345+
fi
346+
331347
echo "ROUTE_TOKEN=$ROUTE_TOKEN" >> $GITHUB_ENV
332348
echo "ROUTE_PATH=$ROUTE_PATH" >> $GITHUB_ENV
333349
334350
- name: Send test webhook
335351
run: |
352+
echo "Using route: /r/$ROUTE_TOKEN/$ROUTE_PATH"
353+
336354
RESPONSE=$(curl -s -o /tmp/webhook_response.txt -w "%{http_code}" \
337355
-X POST http://localhost:3001/r/$ROUTE_TOKEN/$ROUTE_PATH \
338356
-H "Content-Type: application/json" \
339357
-d '{"event":"ci_test","data":{"source":"github-actions"}}')
358+
340359
echo "Response code: $RESPONSE"
341360
echo "Response body: $(cat /tmp/webhook_response.txt)"
361+
342362
if [ "$RESPONSE" -ge 400 ]; then
343-
echo "Webhook failed with status $RESPONSE"
363+
echo " Webhook failed with status $RESPONSE"
344364
exit 1
345365
fi
346366

0 commit comments

Comments
 (0)