fix: resolve k6 loadtest data path

This commit is contained in:
2026-05-11 22:18:43 +08:00
parent b994acf635
commit 612d105a23
2 changed files with 20 additions and 7 deletions

View File

@@ -4,7 +4,8 @@ import { SharedArray } from 'k6/data';
import http from 'k6/http';
import { Rate, Trend } from 'k6/metrics';
const DEFAULT_WORKS_DATA = 'scripts/loadtest/data/works-list.local.json';
// k6 resolves open() paths relative to this script file, not the shell cwd.
const DEFAULT_WORKS_DATA = 'data/works-list.local.json';
const WORKS_DATA = __ENV.WORKS_DATA || DEFAULT_WORKS_DATA;
const BASE_URL = (__ENV.BASE_URL || 'http://127.0.0.1:8787').replace(/\/+$/u, '');
const AUTH_TOKEN = __ENV.AUTH_TOKEN || '';