T5: Identity E2E smoke test#70
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
||
| # 1. Health check (direct) | ||
| echo "--- Test 1: Health check (direct) ---" | ||
| wait_for_service "$IDENTITY_URL/healthz" "Identity Service" |
There was a problem hiding this comment.
🚩 wait_for_service failure exits the script without a test summary
The wait_for_service call on line 38 is not wrapped in an if or || guard. If the service never comes up (and assuming the ((attempt++)) bug is fixed), return 1 on line 30 will propagate a non-zero exit under set -e, terminating the script immediately. This means no test summary is printed and the exit code is 1 but with no indication of which tests passed/failed. If this is intentional (bail early when the service is unreachable), it may be worth adding a note or trapping the exit to print the summary. Compare with the gateway health check at line 110 which gracefully skips tests when the gateway is unreachable.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Intentional — if the identity service never comes up, there's nothing useful to test. The early exit with non-zero status signals the failure clearly. This mirrors how the gateway health check gates gateway tests, but for the identity service the entire test suite depends on it being reachable.
| REGISTER_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$IDENTITY_URL/api/identity/register" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{"userName":"smoketest","email":"smoke@test.com","password":"SmokeTest123!"}') | ||
| REGISTER_BODY=$(echo "$REGISTER_RESPONSE" | head -n -1) | ||
| REGISTER_CODE=$(echo "$REGISTER_RESPONSE" | tail -n 1) | ||
| if [ "$REGISTER_CODE" = "201" ]; then | ||
| log_pass "POST /api/identity/register → 201" | ||
| else | ||
| log_fail "POST /api/identity/register" "expected 201, got $REGISTER_CODE — body: $REGISTER_BODY" | ||
| fi |
There was a problem hiding this comment.
🚩 Test is not idempotent — re-running will attempt to register the same users
The test registers hardcoded users smoketest and gwsmoke. If the test is run a second time against the same database, registration will likely fail (duplicate user), causing tests 2 and the gateway register test to fail. The script doesn't clean up users after running or handle the 409/conflict case. This is a common issue with E2E tests and may warrant either randomized usernames, a cleanup step, or treating 409 as acceptable on registration.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
By design — this smoke test is intended to run against a fresh docker compose up with a clean database each time. The containers are torn down after the test run, so user collisions don't arise in practice.
Summary
Adds
tests/identity-smoke-test.sh— an E2E smoke test that validates the Identity microservice end-to-end, both directly and through the API gateway.The script runs 10 assertions covering the full auth lifecycle:
:5001): health check, register → 201, login → 200 + JWT extraction, unauthenticated → 401, authenticated → 200:5000): same register/login/auth flow routed through YARPGateway tests are skipped gracefully when the gateway isn't reachable. The script exits non-zero on any failure.
Verified locally: Dockerfile builds, all assertions pass against docker compose services (postgres + identity-service + api-gateway).
Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/0f07b7a8f1014aec962930431c54da9f
Requested by: @mbatchelor81