Fix FRE-4928 P1 review findings: setup() data passing, EXIT_CODE capture
- P1#1: Document constant-arrival-rate limitation (no setup() data to scenarios) - P1#2: Capture EXIT_CODE inside each case branch to avoid set -e truncation Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -268,30 +268,25 @@ export function mixedWorkload() {
|
||||
}
|
||||
|
||||
// Individual endpoint scenarios — each makes exactly 1 HTTP call per iteration
|
||||
// NOTE: constant-arrival-rate executor does not pass setup() data to scenario functions.
|
||||
// Standalone runs always use fake tokens (expected 401/403). For real-token testing,
|
||||
// run as part of the mixedWorkload scenario or switch to vus executor.
|
||||
export function loginOnly() {
|
||||
testLogin();
|
||||
sleep(0.1);
|
||||
}
|
||||
|
||||
export function logoutOnly(data) {
|
||||
if (data && data.warmupSuccess) {
|
||||
testLogout(data.accessToken, data.refreshToken);
|
||||
} else {
|
||||
const poolEntry = tokenPool[Math.floor(Math.random() * tokenPool.length)];
|
||||
console.warn('[logoutOnly] Using fake token (warmup skipped or failed)');
|
||||
testLogout(poolEntry.accessToken, poolEntry.refreshToken);
|
||||
}
|
||||
export function logoutOnly() {
|
||||
const poolEntry = tokenPool[Math.floor(Math.random() * tokenPool.length)];
|
||||
console.warn('[logoutOnly] Using fake token (constant-arrival-rate does not pass setup() data)');
|
||||
testLogout(poolEntry.accessToken, poolEntry.refreshToken);
|
||||
sleep(0.1);
|
||||
}
|
||||
|
||||
export function refreshOnly(data) {
|
||||
if (data && data.warmupSuccess) {
|
||||
testRefresh(data.refreshToken);
|
||||
} else {
|
||||
const poolEntry = tokenPool[Math.floor(Math.random() * tokenPool.length)];
|
||||
console.warn('[refreshOnly] Using fake token (warmup skipped or failed)');
|
||||
testRefresh(poolEntry.refreshToken);
|
||||
}
|
||||
export function refreshOnly() {
|
||||
const poolEntry = tokenPool[Math.floor(Math.random() * tokenPool.length)];
|
||||
console.warn('[refreshOnly] Using fake token (constant-arrival-rate does not pass setup() data)');
|
||||
testRefresh(poolEntry.refreshToken);
|
||||
sleep(0.1);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,26 +28,27 @@ echo "Duration: ${DURATION:-300s}"
|
||||
echo "Base URL: ${DARKWATCH_BASE_URL:-http://localhost:3000}"
|
||||
echo ""
|
||||
|
||||
EXIT_CODE=0
|
||||
case "$SCENARIO" in
|
||||
mixed)
|
||||
k6 run darkwatch-auth.js \
|
||||
--summary-export "$OUTPUT_DIR/summary-${TIMESTAMP}.json" \
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json"
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json" || EXIT_CODE=$?
|
||||
;;
|
||||
login)
|
||||
k6 run --scenario login_only darkwatch-auth.js \
|
||||
--summary-export "$OUTPUT_DIR/summary-${TIMESTAMP}.json" \
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json"
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json" || EXIT_CODE=$?
|
||||
;;
|
||||
logout)
|
||||
k6 run --scenario logout_only darkwatch-auth.js \
|
||||
--summary-export "$OUTPUT_DIR/summary-${TIMESTAMP}.json" \
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json"
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json" || EXIT_CODE=$?
|
||||
;;
|
||||
refresh)
|
||||
k6 run --scenario refresh_only darkwatch-auth.js \
|
||||
--summary-export "$OUTPUT_DIR/summary-${TIMESTAMP}.json" \
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json"
|
||||
--out json="$OUTPUT_DIR/results-${TIMESTAMP}.json" || EXIT_CODE=$?
|
||||
;;
|
||||
*)
|
||||
echo "Unknown scenario: $SCENARIO"
|
||||
@@ -56,8 +57,6 @@ case "$SCENARIO" in
|
||||
;;
|
||||
esac
|
||||
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [[ $EXIT_CODE -eq 0 ]]; then
|
||||
echo ""
|
||||
echo "✅ All thresholds passed!"
|
||||
|
||||
Reference in New Issue
Block a user