forked from mtusi2026/mtusi2026lab3
lab3: доказательства уровня 4 и контроль пробы на финальной сборке, документация
This commit is contained in:
@@ -56,7 +56,6 @@ const runId = randomUUID().replaceAll('-', '').slice(0, 12);
|
||||
// timeout, so every outage step costs up to DATABASE_CONNECTION_TIMEOUT_MS.
|
||||
const outagedRequestBudgetMs = 180_000;
|
||||
const slotBudgetMs = 20_000;
|
||||
// Rotation is checked with HTTP reads through the LB, not with check counters.
|
||||
const readyReads = 16;
|
||||
const saturatingWrites = 60; // больше, чем replicas × DATABASE_POOL_MAX (2 × 10)
|
||||
|
||||
@@ -173,8 +172,6 @@ async function waitFor(
|
||||
}
|
||||
}
|
||||
|
||||
// Contract of the bounded unavailable error, checked both on the API replica
|
||||
// (JSON body with request_id) and through the load balancer.
|
||||
function expectBoundedError(
|
||||
status: number,
|
||||
text: string,
|
||||
@@ -485,7 +482,6 @@ describe.skipIf(!enabled)('dependency outages', () => {
|
||||
expect(sent.response.status).toBe(201);
|
||||
message = sent.body;
|
||||
replicas = await apiContainers();
|
||||
// Partial removal from rotation needs a healthy peer to compare with.
|
||||
expect(replicas.length).toBeGreaterThanOrEqual(2);
|
||||
await waitForSlot(
|
||||
(slots) => upSlots(slots).length === replicas.length,
|
||||
@@ -555,9 +551,6 @@ describe.skipIf(!enabled)('dependency outages', () => {
|
||||
await compose('stop', redisService);
|
||||
const replica = replicas[0];
|
||||
|
||||
// The replica itself stays bounded: liveness is unaffected, readiness
|
||||
// and business requests report the missing dependency with an API
|
||||
// error body.
|
||||
expect((await probeReplica(replica, '/health/live')).status).toBe(
|
||||
200,
|
||||
);
|
||||
@@ -584,9 +577,6 @@ describe.skipIf(!enabled)('dependency outages', () => {
|
||||
(JSON.parse(anonymous.text) as ApiErrorBody).error.code,
|
||||
).toBe('unauthorized');
|
||||
|
||||
// The shared dependency is missing for every replica: a client keeps
|
||||
// getting 503 (from a replica first, then from the LB itself), and
|
||||
// once all backends have left rotation the answer is the LB's own.
|
||||
expectUnavailableThroughLb(
|
||||
await request<ApiErrorBody>('/api/v1/users/me', {
|
||||
headers: bearer(token),
|
||||
@@ -676,8 +666,6 @@ describe.skipIf(!enabled)('dependency outages', () => {
|
||||
registration.requestId,
|
||||
);
|
||||
|
||||
// Every replica loses the shared database; a client keeps getting 503,
|
||||
// first from a replica and then from the LB itself.
|
||||
expectUnavailableThroughLb(
|
||||
await request<ApiErrorBody>('/api/v1/users/me', {
|
||||
headers: bearer(token),
|
||||
@@ -740,7 +728,6 @@ describe.skipIf(!enabled)('dependency outages', () => {
|
||||
await applyReplicaDatabaseReject(selectedIp);
|
||||
const faultAt = Date.now();
|
||||
|
||||
// The selected replica reports the loss, the healthy one does not.
|
||||
await waitForReplicaReadiness(selected, 503, 30_000);
|
||||
expect(
|
||||
(await probeReplica(healthy, '/health/ready')).status,
|
||||
@@ -766,8 +753,6 @@ describe.skipIf(!enabled)('dependency outages', () => {
|
||||
slots.find((slot) => slot.addr === selectedAddress)?.status,
|
||||
).toBe('DOWN');
|
||||
|
||||
// Traffic through the LB stays on the healthy replica: no errors
|
||||
// and no request served by the replica that lost its database.
|
||||
const served = new Set<string>();
|
||||
for (let index = 0; index < readyReads; index += 1) {
|
||||
const read = await historyOf(chat.id, token);
|
||||
@@ -782,7 +767,6 @@ describe.skipIf(!enabled)('dependency outages', () => {
|
||||
await restoreDatabaseAccess();
|
||||
}
|
||||
|
||||
// The restored replica answers again and returns to rotation.
|
||||
await waitForReplicaReadiness(selected, 200, 30_000);
|
||||
await waitForSlot(
|
||||
(slots) =>
|
||||
|
||||
Reference in New Issue
Block a user