lab5: e2e, fault suite и доказательства

This commit is contained in:
2026-11-05 01:17:58 +03:00
parent d19824f546
commit 551cf70989
28 changed files with 2269 additions and 60 deletions
+9 -5
View File
@@ -13,6 +13,7 @@ import type { Page } from '../src/common/http/page.js';
import type { Message } from '../src/messages/message.js';
import type { User } from '../src/users/user.js';
import { noisePng } from './support/png.js';
import { waitReady } from './support/e2e.js';
// Automated counterpart of the manual Redis/PostgreSQL outage checks. Four
// topologies, because the load balancer probes /health/ready (the same route as
@@ -924,7 +925,8 @@ describe.skipIf(!enabled)('dependency outages', () => {
},
);
const before = await upload(samplePng, `s3before-${runId}.png`);
expect(before.response.status).toBe(201);
expect(before.response.status).toBe(202);
await waitReady(token, before.body.id);
await compose('stop', s3Service);
try {
@@ -969,7 +971,8 @@ describe.skipIf(!enabled)('dependency outages', () => {
Buffer.from(await bytes.arrayBuffer()).equals(samplePng),
).toBe(true);
const after = await upload(samplePng, `s3after-${runId}.png`);
expect(after.response.status).toBe(201);
expect(after.response.status).toBe(202);
await waitReady(token, after.body.id);
// A `deleting` row is re-claimed one minute after its last change
// (an in-flight compensation is never raced), then swept.
@@ -1001,7 +1004,8 @@ describe.skipIf(!enabled)('dependency outages', () => {
body: samplePng as unknown as BodyInit,
},
);
expect(created.response.status).toBe(201);
expect(created.response.status).toBe(202);
await waitReady(token, created.body.id);
// A paused container keeps its TCP port open but never answers: the
// failure mode a stopped container (connection refused) does not show.
const container = (await compose('ps', '-q', s3Service)).split(
@@ -1084,9 +1088,9 @@ describe.skipIf(!enabled)('dependency outages', () => {
await waitForReadiness(200);
const key = await psql(
`select object_key from attachments where ${filter}`,
`select staging_key from attachments where ${filter}`,
);
expect(key).toMatch(/^attachments\/[0-9a-f-]{36}\/original$/u);
expect(key).toMatch(/^staging\/[0-9a-f-]{36}\/original$/u);
// Without PostgreSQL the API cannot tell a lost commit from a failed
// one, so it deletes nothing; the pending row keeps the object tracked.
expect(await objectExists(key)).toBe(true);