chore: port lab 6 solution into the lab 7 skeleton

Source: mtusi2026lab6-safronov, solution/bvt2301-safronov, 6c6a065.
Files follow AGENTS.md, "Переход в следующую лабу". Contracts, public
tests, README, REPORT and evidence of lab 6 are not carried over; infra
and scripts of the lab 7 skeleton stay as they are.
Makefile is the lab 6 one with the lab 7 skeleton part restored
(HTTPS BASE_URL on 8443, test-security); .gitignore and .dockerignore
are taken from lab 6 because both skeletons have the same files;
.env.example is the lab 6 one without changes.
The compose project, image and CI prefix are renamed to lab7, and
references to the previous lab now name lab6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 03:59:04 +03:00
co-authored by Claude Opus 5.5
parent 20afc2c790
commit 089d78609d
687 changed files with 178271 additions and 40 deletions
+69
View File
@@ -0,0 +1,69 @@
// Пользователи и чаты стенда: читаемый (сценарий read), чат записи
// (сценарий write) и фоновые чаты неравномерных размеров (трек 2). Каждый
// пользователь регистрируется с паролем и входит по Basic; в фикстуру идут
// id и Bearer-токены, пароли — нет. Итог — fixture.json в рабочем каталоге:
// оркестратор удаляет его в конце прогона.
import { WORK_DIR, createChat, register } from "./lib.js";
const MEMBERS = Number(__ENV.MEMBERS || 10);
// чатов записи (Profile.write_chats): у прежних профилей один
const WRITE_CHATS = Math.max(1, Number(__ENV.WRITE_CHATS || 1));
// уровни фоновых чатов: «10x5000,100x400» — число чатов x сообщений в чате
const BACKGROUND = (__ENV.BACKGROUND || "")
.split(",")
.filter((tier) => tier !== "")
.map((tier) => tier.split("x").map(Number));
export const options = {
vus: 1,
iterations: 1,
setupTimeout: "5m",
};
export function setup() {
// размер начинается с пустой базы, поэтому имени хватает времени
const stamp = Date.now().toString(36);
const tokens = {};
const reader = register(`b${stamp}_reader`, "Bench reader");
tokens[reader.id] = reader.token;
const memberIds = [];
for (let i = 0; i < MEMBERS; i++) {
const member = register(`b${stamp}_m${i}`, `Bench member ${i}`);
tokens[member.id] = member.token;
memberIds.push(member.id);
}
const everyone = [reader.id, ...memberIds];
// фоновые чаты в порядке уровней: номер чата в расписании наполнения —
// 1 + индекс в этом списке (0 — читаемый чат)
const bgChats = [];
for (const [count, size] of BACKGROUND) {
for (let i = 0; i < count; i++) {
const title = `bench bg ${size} #${i}`;
bgChats.push({ id: createChat(reader.token, title, everyone), size });
}
}
const readChatId = createChat(reader.token, "bench read", everyone);
// чаты записи со всеми пользователями: серии трека 1 делят вставки на
// WRITE_CHATS правых краёв индекса истории (решение 2 design change
// scaling-bench); прежние сценарии пишут в первый — writeChatId
const writeChatIds = [];
for (let i = 0; i < WRITE_CHATS; i++) {
const title = i === 0 ? "bench write" : `bench write #${i}`;
writeChatIds.push(createChat(reader.token, title, everyone));
}
return {
readerId: reader.id,
memberIds,
tokens,
readChatId,
writeChatId: writeChatIds[0],
writeChatIds,
bgChats,
};
}
export default function () {}
export function handleSummary(data) {
return { [`${WORK_DIR}/fixture.json`]: JSON.stringify(data.setup_data) };
}