forked from mtusi2026/mtusi2026lab5
lab5: устойчивость очереди, восстановление job и права broker
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user