chore: commit all pending changes and ignore project context
This commit is contained in:
@@ -4,6 +4,7 @@ import exec from 'k6/execution';
|
||||
import { Counter, Rate, Trend } from 'k6/metrics';
|
||||
|
||||
const BASE_URL = (__ENV.BASE_URL || 'https://stend.4mont.ru').replace(/\/$/, '');
|
||||
const HOST_HEADER = (__ENV.HOST_HEADER || '').trim();
|
||||
const SERVICE_SLUGS = (__ENV.SERVICE_SLUGS || 'vmmanager')
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
@@ -51,6 +52,7 @@ const selected = PROFILE_OPTIONS[PROFILE] || PROFILE_OPTIONS.smoke;
|
||||
|
||||
export const options = {
|
||||
...selected,
|
||||
noCookiesReset: true,
|
||||
insecureSkipTLSVerify: (__ENV.INSECURE_TLS || '0') === '1',
|
||||
thresholds: {
|
||||
http_req_failed: ['rate<0.02'],
|
||||
@@ -61,6 +63,11 @@ export const options = {
|
||||
|
||||
let loggedInKey = '';
|
||||
|
||||
function withHostHeaders(headers = {}) {
|
||||
if (!HOST_HEADER) return headers;
|
||||
return { ...headers, Host: HOST_HEADER };
|
||||
}
|
||||
|
||||
function parseUsersCsv(raw) {
|
||||
if (!raw.trim()) return [];
|
||||
return raw
|
||||
@@ -98,7 +105,11 @@ function ensureLoggedIn() {
|
||||
const jar = http.cookieJar();
|
||||
jar.clear(BASE_URL);
|
||||
|
||||
const landing = http.get(`${BASE_URL}/`, { redirects: 0, tags: { name: 'GET /' } });
|
||||
const landing = http.get(`${BASE_URL}/`, {
|
||||
redirects: 0,
|
||||
tags: { name: 'GET /' },
|
||||
headers: withHostHeaders(),
|
||||
});
|
||||
const csrfFromCookie = (jar.cookiesForURL(BASE_URL).csrf_token || [])[0] || '';
|
||||
const csrf = csrfFromCookie || ((landing.cookies.csrf_token || [])[0] || {}).value || '';
|
||||
if (!csrf) {
|
||||
@@ -114,7 +125,7 @@ function ensureLoggedIn() {
|
||||
|
||||
const loginRes = http.post(`${BASE_URL}/login`, payload, {
|
||||
redirects: 0,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
headers: withHostHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' }),
|
||||
tags: { name: 'POST /login' },
|
||||
});
|
||||
|
||||
@@ -150,6 +161,7 @@ export default function () {
|
||||
const openRes = http.get(`${BASE_URL}/go/${slug}`, {
|
||||
redirects: 0,
|
||||
tags: { name: 'GET /go/:slug' },
|
||||
headers: withHostHeaders(),
|
||||
});
|
||||
openLatency.add(openRes.timings.duration);
|
||||
|
||||
@@ -187,6 +199,7 @@ export default function () {
|
||||
const touchRes = http.post(`${BASE_URL}/api/sessions/${sessionId}/touch`, null, {
|
||||
redirects: 0,
|
||||
tags: { name: 'POST /api/sessions/:id/touch' },
|
||||
headers: withHostHeaders(),
|
||||
});
|
||||
|
||||
if (touchRes.status === 410) {
|
||||
@@ -208,6 +221,7 @@ export default function () {
|
||||
const closeRes = http.post(`${BASE_URL}/api/sessions/${sessionId}/close`, null, {
|
||||
redirects: 0,
|
||||
tags: { name: 'POST /api/sessions/:id/close' },
|
||||
headers: withHostHeaders(),
|
||||
});
|
||||
closeCalls.add(1);
|
||||
check(closeRes, {
|
||||
|
||||
Reference in New Issue
Block a user