Files
mtusi2026lab2/bench/k6/prepare.js
T
ricoromaandClaude Opus 5.5 7b775a29a9 chore: carry over lab 1 solution into lab 2 skeleton
Copy the committed lab 1 sources as-is: src/, student-tests/, bench/,
Dockerfile, docker-compose.yml, pyproject.toml, uv.lock,
.python-version, config_example.toml, AGENTS.md, CLAUDE.md, .claude/,
openspec/, .graphifyignore and KNOWN_ISSUES.md. Lab 1 evidence stays
in the lab 1 repository.

Merge the new skeleton files with own sections: Makefile (lab 2
targets plus own run, docker, bench and common targets), .gitignore,
.dockerignore and .env.example. Rename the image to
mtusi-messenger:lab2 and point AGENTS.md at lab 2.

The application is still the in-memory lab 1 implementation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:11:46 +03:00

35 lines
1.1 KiB
JavaScript

// Пользователи и два чата стенда: читаемый (сценарий read) и чат записи
// (сценарий write). Итог — fixture.json в рабочем каталоге.
import { WORK_DIR, createChat, register } from "./lib.js";
const MEMBERS = Number(__ENV.MEMBERS || 10);
export const options = {
vus: 1,
iterations: 1,
setupTimeout: "60s",
};
export function setup() {
// размер начинается с пустого процесса, поэтому имени хватает времени
const stamp = Date.now().toString(36);
const readerId = register(`b${stamp}_reader`, "Bench reader");
const memberIds = [];
for (let i = 0; i < MEMBERS; i++) {
memberIds.push(register(`b${stamp}_m${i}`, `Bench member ${i}`));
}
const everyone = [readerId, ...memberIds];
return {
readerId,
memberIds,
readChatId: createChat(readerId, "bench read", everyone),
writeChatId: createChat(readerId, "bench write", everyone),
};
}
export default function () {}
export function handleSummary(data) {
return { [`${WORK_DIR}/fixture.json`]: JSON.stringify(data.setup_data) };
}