This document covers the testing infrastructure for Artifact Keeper, including unit tests, integration tests, and end-to-end (E2E) tests.
# Backend tests (requires PostgreSQL)
cargo test --workspace
# E2E tests with Docker (fully automated, no human in the loop)
./scripts/run-e2e-tests.shTests run automatically on push/PR via GitHub Actions. See .github/workflows/ci.yml.
┌─────────────────────────────────────────────────────────────────┐
│ Test Pyramid │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────┐ │
│ │ E2E Tests │ Native client tests │
│ │ (Docker) │ (PyPI, NPM, Cargo, etc) │
│ ┌┴───────────────┴┐ │
│ ┌┴─────────────────┴┐ │
│ ┌┴───────────────────┴┐ │
│ │ Integration Tests │ Cargo test │
│ │ (PostgreSQL) │ (API + DB) │
│ ┌┴─────────────────────┴┐ │
│ ┌┴───────────────────────┴┐ │
│ ┌┴─────────────────────────┴┐ │
│ │ Unit Tests │ Cargo test │
│ │ (Functions, logic) │ (Isolated) │
│ └───────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
# Run all backend tests
cargo test --workspace
# Run with verbose output
cargo test --workspace -- --nocapture
# Run specific test
cargo test test_create_repository
# Run integration tests only
cargo test --test integration_testsbackend/tests/integration_tests.rs- API integration testsbackend/src/**/*.rs- Unit tests (inline#[cfg(test)]modules)
Run fully automated E2E tests without any manual setup:
# Run all E2E tests in containers
./scripts/run-e2e-tests.sh
# Force rebuild containers
./scripts/run-e2e-tests.sh --build
# Clean up after tests
./scripts/run-e2e-tests.sh --clean┌─────────────────────────────────────────────────────────────────┐
│ docker-compose.test.yml │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ PostgreSQL │────▶│ Backend │◀────│ Native │ │
│ │ (tmpfs) │ │ (Rust) │ │ Clients │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
| Service | Image | Purpose |
|---|---|---|
postgres |
postgres:16-alpine | Test database (tmpfs for speed) |
backend |
Custom (Rust) | API server |
pypi-test |
python:3.12-slim | PyPI native client test |
npm-test |
node:20-slim | NPM native client test |
cargo-test |
rust:1.75-slim | Cargo native client test |
Tests run automatically via .github/workflows/ci.yml:
- lint-rust -
cargo fmtandcargo clippy - test-backend-unit - Rust unit tests
- test-backend-integration - Integration tests (main branch only)
- build-backend - Release build
- smoke-e2e - Native client smoke tests
- security-audit - Dependency audit
| Test Type | Target Coverage |
|---|---|
| Unit Tests | 80%+ |
| E2E Tests | Critical paths |