tested k9 reports

This commit is contained in:
Wowieee4
2026-05-17 19:36:46 +07:00
parent d2608e0188
commit c566c026cd
51 changed files with 62875 additions and 114 deletions
@@ -6,14 +6,17 @@
* Target: p95 auth latency < 800ms, error rate < 1%
*/
import { sleep, check } from "k6";
import {
DEFAULT_THRESHOLDS,
handleSummary,
} from "../modules/metrics-helper.js";
import {
DEFAULT_THRESHOLDS,
handleSummary,
pickThresholds,
} from "../modules/metrics-helper.js";
import * as api from "../modules/api-client.js";
import { testData } from "../modules/test-data.js";
import { registerAndLogin, doRefreshToken } from "../modules/auth-helper.js";
import { testData } from "../modules/test-data.js";
import { registerAndLogin, doRefreshToken } from "../modules/auth-helper.js";
const RUN_ID = __ENV.RUN_ID || `${Date.now()}`;
// ── Konfigurasi test — override via --config atau env ───────────────────────
export const options = {
scenarios: {
@@ -28,12 +31,16 @@ export const options = {
],
gracefulRampDown: "15s",
},
},
thresholds: {
...DEFAULT_THRESHOLDS,
walkguide_auth_latency_ms: ["p(95)<800", "p(99)<1500"],
},
};
},
thresholds: pickThresholds(
__ENV.BENCH_PROFILE === "local"
? { walkguide_auth_latency_ms: ["p(95)<35000", "p(99)<40000"] }
: {
...DEFAULT_THRESHOLDS,
walkguide_auth_latency_ms: ["p(95)<800", "p(99)<1500"],
},
),
};
// ── Main VU function ──────────────────────────────────────────────────────────
@@ -42,7 +49,7 @@ export default function authFlow() {
// ── Step 1: Register user baru (setiap VU punya unique email) ───────────────
const role = vuId % 2 === 0 ? "ROLE_GUARDIAN" : "ROLE_USER";
const suffix = `${vuId}_${__ITER}`;
const suffix = `${RUN_ID}_${vuId}_${__ITER}`;
const payload =
role === "ROLE_GUARDIAN"
? testData.guardianRegisterPayload(suffix)
@@ -8,11 +8,12 @@
* Target: p95 < 300ms, error rate < 1%
*/
import { sleep, check } from "k6";
import {
DEFAULT_THRESHOLDS,
handleSummary,
metricsHelper,
} from "../modules/metrics-helper.js";
import {
DEFAULT_THRESHOLDS,
handleSummary,
metricsHelper,
pickThresholds,
} from "../modules/metrics-helper.js";
import * as api from "../modules/api-client.js";
import { testData } from "../modules/test-data.js";
@@ -32,12 +33,19 @@ export const options = {
gracefulRampDown: "15s",
},
},
thresholds: {
...DEFAULT_THRESHOLDS,
walkguide_location_latency_ms: ["p(95)<300", "p(99)<600"],
http_req_duration: ["p(95)<400"],
},
};
thresholds: pickThresholds(
__ENV.BENCH_PROFILE === "local"
? {
http_req_duration: ["p(95)<35000", "p(99)<40000"],
walkguide_location_latency_ms: ["p(95)<3000", "p(99)<5000"],
}
: {
...DEFAULT_THRESHOLDS,
walkguide_location_latency_ms: ["p(95)<300", "p(99)<600"],
http_req_duration: ["p(95)<400"],
},
),
};
// ── VU shared state (tiap VU punya token sendiri) ─────────────────────────────
let vuTokens = null;