Files
mtusi2026lab2/bench/k6/write.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

40 lines
1.1 KiB
JavaScript

// Сценарий write: ровно COUNT сообщений в чат записи от участников по
// кругу, VUS клиентов одновременно. Читаемый чат не меняется.
import exec from "k6/execution";
import {
SUMMARY_THRESHOLDS,
SUMMARY_TREND_STATS,
WORK_DIR,
sendMessage,
summaryFiles,
syntheticText,
} from "./lib.js";
const fixture = JSON.parse(open(`${WORK_DIR}/fixture.json`));
const OFFSET = Number(__ENV.OFFSET || 0);
export const options = {
scenarios: {
write: {
executor: "shared-iterations",
vus: Number(__ENV.VUS),
iterations: Number(__ENV.COUNT),
maxDuration: "10m",
},
},
discardResponseBodies: true,
summaryTrendStats: SUMMARY_TREND_STATS,
thresholds: SUMMARY_THRESHOLDS,
};
export default function () {
const n = OFFSET + exec.scenario.iterationInTest;
const sender = fixture.memberIds[n % fixture.memberIds.length];
sendMessage(fixture.writeChatId, sender, syntheticText("w", n));
}
export function handleSummary(data) {
return summaryFiles(data);
}