Load Tests #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Load Tests | |
| # Runs on every PR and push to the main branches so a performance regression | |
| # blocks the merge (issue #1167), and nightly for trend tracking. | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| schedule: | |
| # Run nightly at 02:00 UTC | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| # Cancel in-progress runs for the same branch/PR when a new push arrives. | |
| # This avoids wasting CI minutes (especially the 15-min load-test job) on | |
| # now-superseded commits. Scheduled/manual runs are not cancelled. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| load-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| # Performance gate thresholds live in tests/load/PerformanceBaselines.js. | |
| # Shared GitHub runners are noisier/slower than a dev box, so we widen the | |
| # tolerances here (not the targets) to keep the gate meaningful without | |
| # being flaky. See docs/LOAD_TESTING.md. | |
| LOAD_TEST_LATENCY_MARGIN: '2.0' # tolerate up to 2x the target latency | |
| LOAD_TEST_THROUGHPUT_MARGIN: '0.5' # tolerate down to 50% of target throughput | |
| LOAD_TEST_ERROR_RATE_MARGIN: '1.0' # error-rate ceilings are not relaxed | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run load tests (gates the merge on SLO thresholds) | |
| env: | |
| MOCK_STELLAR: 'true' | |
| NODE_ENV: test | |
| API_KEYS: 'test-load-key,test-key-1,test-key-2' | |
| ENCRYPTION_KEY: test_encryption_key_fixed_32bytes_hex_value_here_00 | |
| # Warm-up requests absorb cold-start variance before measurement. The | |
| # script exits non-zero when any threshold is exceeded, failing the job. | |
| run: npm run test:load -- --output ./reports/load --concurrency 10 --iterations 50 --warmup 10 | |
| - name: Upload load test report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: load-test-report | |
| path: reports/load/ | |
| retention-days: 30 |