Clear cookie jar between benchmark user setups

setup() runs in a single iteration, so k6 does not reset the per-VU
cookie jar between the users we create. The second user's session
request carried the first user's session cookie, so the server rejected
it with "session already active" (401). Clear the jar after capturing
each user's cookie; flows authenticate via explicit Cookie headers, so
clearing the jar is safe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
loks0nandClaude Opus 4.8 committed 2026-06-26 16:31:40 +01:00
1 parent ea2e3b76fb
commit e29146f9f6
1 file changed
+4
+4
View File
@@ -209,6 +209,10 @@ function setupUsers(projectId, count) {
}, headers, [201], 'setup.account.session');
users.push({ sessionHeaders: { ...headers, Cookie: cookieHeader(session) } });
// Drop the auto-stored session cookie so the next user can sign in;
// setup() runs in a single iteration, so the jar is not reset for us.
http.cookieJar().clear(ENDPOINT);
}
return users;