Add load testing job to GitHub Actions CI pipeline [FRE-4931]

This commit is contained in:
2026-05-09 07:56:52 -04:00
parent 92476653b4
commit 6f90db8503
6 changed files with 301 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
# FRE-4931: Load Testing Job Implementation
## Overview
Added load testing job to GitHub Actions CI pipeline for FrenoCorp.
## Implementation Details
### New Files Created
1. **`.github/workflows/load-testing.yml`**
- Triggers on PR pushes to main (load-test paths)
- Scheduled daily at 2 AM UTC
- Two jobs: `load-test` and `performance-baseline`
- Uses Node.js 20 with caching
2. **`scripts/load-test/package.json`**
- Load testing dependencies (k6, axios)
- Scripts for running tests and baseline comparison
3. **`scripts/load-test/run-load-test.js`**
- Main load test runner
- Configurable concurrency and duration via environment variables
- Tests multiple API endpoints concurrently
- Reports success rate and average response time
4. **`scripts/load-test/compare-baseline.js`**
- Compares current performance against baseline
- Fails PR if performance degrades beyond threshold
- Creates initial baseline if none exists
5. **`scripts/load-test/reports/baseline.json`**
- Initial performance baseline
- Avg response time: 100ms
- Success rate: 99%
### Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `API_BASE_URL` | https://api.frenocorp.com | Target API endpoint |
| `LOAD_TEST_CONCURRENCY` | 10 | Concurrent users |
| `LOAD_TEST_DURATION` | 60 | Test duration in seconds |
| `BASELINE_THRESHOLD` | 0.1 | Max acceptable performance degradation (10%) |
### Workflow Integration
The load testing workflow:
- Runs on PRs that modify load test files
- Executes scheduled daily at 2 AM UTC
- Uploads results as artifacts for 7 days
- Compares against baseline on PRs
- Fails if performance degrades beyond threshold
## Next Steps
- [ ] Add actual API endpoint definitions based on FrenoCorp API spec
- [ ] Configure GitHub secrets for production API URL
- [ ] Set up baseline monitoring dashboard
- [ ] Add Slack notifications for performance regressions