forked from mtusi2026/mtusi2026lab7
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>
42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
// Этап плана: страницы истории из plan_pages.json подряд, пока в Postgres
|
|
// стенда включён auto_explain. Для читаемого чата и первого чата каждого
|
|
// фонового уровня — первая, средняя и последняя полная страница (у
|
|
// короткого чата — первая). Порядок запросов = порядок планов в журнале:
|
|
// оркестратор сопоставляет их по нему.
|
|
import http from "k6/http";
|
|
import { check, fail } from "k6";
|
|
|
|
import { API, PAGE_LIMIT, WORK_DIR, authHeaders } from "./lib.js";
|
|
|
|
const fixture = JSON.parse(open(`${WORK_DIR}/fixture.json`));
|
|
const pages = JSON.parse(open(`${WORK_DIR}/plan_pages.json`));
|
|
|
|
export const options = {
|
|
vus: 1,
|
|
iterations: 1,
|
|
};
|
|
|
|
export default function () {
|
|
const params = { headers: authHeaders(fixture.tokens[fixture.readerId]) };
|
|
for (const page of pages) {
|
|
const name = `${page.chat} ${page.page}`;
|
|
const query = page.cursor === null
|
|
? `?limit=${PAGE_LIMIT}`
|
|
: `?limit=${PAGE_LIMIT}&cursor=${encodeURIComponent(page.cursor)}`;
|
|
const res = http.get(`${API}/chats/${page.chat_id}/messages${query}`, params);
|
|
const ok = check(res, {
|
|
[`${name} 200`]: (r) => r.status === 200,
|
|
[`${name} ${page.items} items`]: (r) =>
|
|
r.status === 200 && r.json("items.#") === page.items,
|
|
});
|
|
if (!ok) {
|
|
fail(`explain page ${name}: ${res.status}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
// итог не нужен: планы оркестратор берёт из журнала Postgres
|
|
export function handleSummary() {
|
|
return {};
|
|
}
|