lab5: устойчивость очереди, восстановление job и права broker

This commit is contained in:
2026-11-05 04:05:07 +03:00
parent 2638e1c2c4
commit 0790599d2f
44 changed files with 1122 additions and 343 deletions
+12
View File
@@ -1,6 +1,7 @@
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
import sharp from 'sharp';
import { JobTimeoutError } from '../jobs/errors.js';
import { renderVariants, type RenderedVariant } from './pipelines.js';
const sample = readFileSync(
@@ -81,6 +82,17 @@ describe('renderVariants', () => {
);
});
it('honours an aborted job deadline before starting a render', async () => {
const controller = new AbortController();
controller.abort(new JobTimeoutError(1));
await expect(
renderVariants(sample, 1, {
...limits,
signal: controller.signal,
}),
).rejects.toBeInstanceOf(JobTimeoutError);
});
it('produces a different v2 thumbnail', async () => {
const v1 = byName(await renderVariants(sample, 1, limits), 'thumbnail');
const v2 = byName(await renderVariants(sample, 2, limits), 'thumbnail');