-
Notifications
You must be signed in to change notification settings - Fork 29
123 lines (106 loc) · 3.16 KB
/
Copy pathload-test.yml
File metadata and controls
123 lines (106 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Load Tests
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'test/load/**'
- '.github/workflows/load-test.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
load-test:
name: k6 Load Tests
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: stellartip_load
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_NAME: stellartip_load
JWT_SECRET: load-test-secret
NODE_ENV: test
PORT: 3000
DB_POOL_SIZE: 10
DB_POOL_SATURATION_CHECK_INTERVAL_MS: 5000
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Start API server
# Match the actual `nest build` output (NestJS CLI 11 + sourceRoot: "src"):
# the entry lives at dist/src/main.js, not dist/main.js.
run: node -r tsconfig-paths/register dist/src/main.js &
env:
PORT: 3000
- name: Wait for API to be ready
run: |
for i in $(seq 1 30); do
curl -sf http://localhost:3000/health && break
echo "Waiting for API... ($i/30)"
sleep 2
done
- name: Run health smoke test
uses: grafana/k6-action@v0.3.1
with:
filename: test/load/health-smoke.js
flags: --out json=results/health-smoke.json
env:
BASE_URL: http://localhost:3000
- name: Run auth rate-limit test
uses: grafana/k6-action@v0.3.1
with:
filename: test/load/auth-rate-limit.js
flags: --out json=results/auth-rate-limit.json
env:
BASE_URL: http://localhost:3000
- name: Run tip creation burst test
uses: grafana/k6-action@v0.3.1
with:
filename: test/load/tip-creation.js
flags: --out json=results/tip-creation.json
env:
BASE_URL: http://localhost:3000
- name: Run profile reads test
uses: grafana/k6-action@v0.3.1
with:
filename: test/load/profile-reads.js
flags: --out json=results/profile-reads.json
env:
BASE_URL: http://localhost:3000
- name: Run database pool readiness test
uses: grafana/k6-action@v0.3.1
with:
filename: test/load/db-pool-readiness.js
flags: --out json=results/db-pool-readiness.json
env:
BASE_URL: http://localhost:3000
- name: Upload load test results
if: always()
uses: actions/upload-artifact@v4
with:
name: k6-load-test-results
path: results/
retention-days: 30