config.js (926B)
1 /** 2 * Shared configuration for k6 tests. 3 * 4 * Override via environment variables: 5 * BASE_URL=http://prod:8080 k6 run federation.js 6 * SERVER_NAMES=mtrnord.blog k6 run federation.js 7 */ 8 9 export const BASE_URL = __ENV.BASE_URL || "http://localhost:8080"; 10 11 // Comma-separated list of Matrix server names to test against 12 export const SERVER_NAMES = (__ENV.SERVER_NAMES || "mtrnord.blog").split(","); 13 14 /** Pick a random entry from an array */ 15 export function randomItem(arr) { 16 return arr[Math.floor(Math.random() * arr.length)]; 17 } 18 19 /** 20 * Default thresholds used across load tests. 21 * 22 * Federation checks are inherently slow (DNS + TLS + HTTP to external servers), 23 * so the p95 threshold is intentionally generous at 10s. 24 * Adjust per-test as needed. 25 */ 26 export const DEFAULT_THRESHOLDS = { 27 http_req_failed: ["rate<0.05"], // fewer than 5% errors 28 http_req_duration: ["p(95)<10000"], // 95th percentile under 10s 29 };