Skip to content

[Infrastructure] Add load testing suite with k6 for API performance validation #185

Description

@Penielka

Description

No load testing exists to validate API performance under realistic traffic. Implement a k6 (or Artillery) test suite that simulates concurrent users hitting key endpoints: course listing, credential verification, enrollment, and analytics queries. Set performance budgets and run in CI on PRs.

Definition of Done

  • k6 installed as dev dependency or available in CI
  • Load test script simulating 100 concurrent users over 5 minutes
  • Scenarios: course browsing (80% read), credential verification (15%), enrollment (5%)
  • Performance budgets: p95 latency <500ms, error rate <1%, throughput >50 req/s
  • Test data seeding script to populate database before tests
  • Tests run against staging environment, not production
  • Results output as JSON for trend analysis
  • CI job runs smoke test (10 users, 1 minute) on every PR
  • Full load test (100 users, 5 minutes) runs on merge to main

Acceptance Criteria

  1. k6 run load-test.js executes successfully against local backend
  2. Smoke test runs in CI on every PR
  3. Performance budgets are checked and failures reported
  4. Test results include p50, p95, p99 latencies and error rate
  5. Seeded data does not persist to production database

Files to Modify

  • New file: tests/load/k6-smoke.js — smoke test (10 users, 1 min)
  • New file: tests/load/k6-full.js — full load test (100 users, 5 min)
  • New file: tests/load/seed-data.js — test data seeder
  • New file: tests/load/config.json — k6 configuration
  • .github/workflows/ci.yml — add load test job (smoke test)
  • backend/package.json — add k6 or artillery dev dependency
  • docker-compose.yml — may add k6 service for local testing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions