Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: E2E Smoke Tests

on:
push:
branches: [main, 'devin/**']
pull_request:
branches: [main, 'devin/**']

jobs:
e2e-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build and start services
working-directory: src
run: |
docker compose -f docker-compose.e2e.yml up -d --build
echo "Waiting for services to start..."
sleep 30

- name: Run smoke tests
run: |
chmod +x tests/e2e/smoke-test.sh
./tests/e2e/smoke-test.sh

- name: Show logs on failure
if: failure()
working-directory: src
run: docker compose -f docker-compose.e2e.yml logs

- name: Cleanup
if: always()
working-directory: src
run: docker compose -f docker-compose.e2e.yml down -v
36 changes: 36 additions & 0 deletions src/docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
services:
api-gateway:
build:
context: .
dockerfile: ApiGateway/Dockerfile
ports:
- "5000:5000"
depends_on:
- customer-service
environment:
- ASPNETCORE_ENVIRONMENT=Development

customer-service:
build:
context: .
dockerfile: Services/Customer/Customer.API/Dockerfile
ports:
- "5002:5002"
depends_on:
- postgres
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__DefaultConnection=Host=postgres;Database=customerdb;Username=postgres;Password=postgres

postgres:
image: postgres:16-alpine
ports:
- "5432:5432"
environment:
POSTGRES_DB: customerdb
POSTGRES_PASSWORD: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.

volumes:
postgres_data:
61 changes: 61 additions & 0 deletions tests/e2e/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
set -euo pipefail

GATEWAY_URL="${GATEWAY_URL:-http://localhost:5000}"
CUSTOMER_URL="${CUSTOMER_URL:-http://localhost:5002}"
MAX_RETRIES=30
RETRY_INTERVAL=5

echo "Waiting for gateway to be healthy..."
for i in $(seq 1 $MAX_RETRIES); do
if curl -sf "$GATEWAY_URL/healthz" > /dev/null 2>&1; then
echo "Gateway is healthy!"
break
fi
if [ "$i" -eq "$MAX_RETRIES" ]; then
echo "Gateway failed to become healthy after $((MAX_RETRIES * RETRY_INTERVAL))s"
exit 1
fi
echo "Attempt $i/$MAX_RETRIES - waiting ${RETRY_INTERVAL}s..."
sleep $RETRY_INTERVAL
done

echo ""
echo "Waiting for customer-service to be healthy..."
for i in $(seq 1 $MAX_RETRIES); do
if curl -sf "$CUSTOMER_URL/healthz" > /dev/null 2>&1; then
echo "Customer service is healthy!"
break
fi
if [ "$i" -eq "$MAX_RETRIES" ]; then
echo "Customer service failed to become healthy after $((MAX_RETRIES * RETRY_INTERVAL))s"
exit 1
fi
echo "Attempt $i/$MAX_RETRIES - waiting ${RETRY_INTERVAL}s..."
sleep $RETRY_INTERVAL
done

echo ""
echo "=== Smoke Test: GET /healthz on customer-service (via direct port) ==="
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$CUSTOMER_URL/healthz")
echo "Response code: $HTTP_CODE"
if [ "$HTTP_CODE" = "200" ]; then
echo "PASS: Customer service health check returns 200"
else
echo "FAIL: Expected 200, got $HTTP_CODE"
exit 1
fi

echo ""
echo "=== Smoke Test: GET /api/customers (unauthenticated - expect 401) ==="
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$GATEWAY_URL/api/customers")
echo "Response code: $HTTP_CODE"
if [ "$HTTP_CODE" = "401" ]; then
echo "PASS: Unauthenticated request correctly returns 401"
else
echo "FAIL: Expected 401, got $HTTP_CODE"
exit 1
fi

echo ""
echo "All smoke tests passed!"
Loading