Skip to content

test: add comprehensive E2E test suite for CLI wrapper #1

test: add comprehensive E2E test suite for CLI wrapper

test: add comprehensive E2E test suite for CLI wrapper #1

Workflow file for this run

name: E2E Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
e2e-tests:
name: E2E Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
services:
capiscio-server:
image: ghcr.io/capiscio/capiscio-server:latest
ports:
- 8080:8080
env:
CAPISCIO_TEST_MODE: "true"
DATABASE_URL: "postgres://test:test@postgres:5432/capiscio_test"
options: >-
--health-cmd "curl -f http://localhost:8080/health || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:15
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: capiscio_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,test]"
- name: Wait for server to be ready
run: |
for i in {1..30}; do
if curl -f http://localhost:8080/health; then
echo "✓ Server is ready"
exit 0
fi
echo "Waiting for server... ($i/30)"
sleep 2
done
echo "✗ Server failed to start"
exit 1
- name: Run unit tests
run: |
pytest tests/unit/ -v --cov=capiscio --cov-report=xml --cov-report=term
- name: Run E2E tests
env:
CAPISCIO_API_URL: http://localhost:8080
# For test mode, these can be dummy values
# The test server accepts X-Test-User-ID header
CAPISCIO_API_KEY: test_api_key_ci
CAPISCIO_TEST_AGENT_ID: 00000000-0000-0000-0000-000000000001
run: |
pytest tests/e2e/ -v --tb=short
- name: Upload coverage reports
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
e2e-against-dev:
name: E2E Tests (Dev Environment)
runs-on: ubuntu-latest
# Only run on main branch
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,test]"
- name: Run E2E tests against dev environment
env:
CAPISCIO_API_URL: https://dev.registry.capisc.io
CAPISCIO_API_KEY: ${{ secrets.DEV_API_KEY }}
CAPISCIO_TEST_AGENT_ID: ${{ secrets.DEV_TEST_AGENT_ID }}
run: |
pytest tests/e2e/ -v --tb=short -k "not badge" || true
# Note: Badge tests may require actual PoP flow which needs secrets
# Using || true to not fail the build if some tests are skipped