Expand support API integration tests and add load script
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-28 21:49:16 +01:00
parent c94fbe4ab8
commit 6e4656946c
2 changed files with 143 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import http from 'k6/http'
import { check, sleep } from 'k6'
const BASE_URL = __ENV.SUPPORT_API_BASE_URL || 'http://localhost'
const TOKEN = __ENV.SUPPORT_API_TOKEN || ''
const DEFAULT_SLEEP = __ENV.SUPPORT_API_SLEEP || '1'
if (!TOKEN) {
throw new Error('SUPPORT_API_TOKEN is required')
}
export const options = {
vus: Number(__ENV.SUPPORT_API_VUS || 10),
duration: __ENV.SUPPORT_API_DURATION || '1m',
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<500'],
},
}
function authHeaders() {
return {
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
}
}
export default function () {
const listTenants = http.get(`${BASE_URL}/api/v1/support/tenants?per_page=25`, authHeaders())
check(listTenants, {
'list tenants 200': (res) => res.status === 200,
})
const listEvents = http.get(`${BASE_URL}/api/v1/support/events?per_page=25`, authHeaders())
check(listEvents, {
'list events 200': (res) => res.status === 200,
})
const listPhotos = http.get(`${BASE_URL}/api/v1/support/photos?per_page=25`, authHeaders())
check(listPhotos, {
'list photos 200': (res) => res.status === 200,
})
sleep(Number(DEFAULT_SLEEP))
}