mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: add CI timeouts for slow image-enhancement tests
Image enhancement involves CLAHE + histogram analysis + multi-step corrections, which exceeds the default 30s vitest timeout on GitHub Actions runners. Add 120s timeouts for image-enhancement tests (large file, HEIF input, format-matrix cross-format).
This commit is contained in:
@@ -188,8 +188,10 @@ function needsFallback(fmt: FormatDef): boolean {
|
|||||||
return fmt.needsCliDecoder || fmt.needsHeifDecoder || fmt.mayFailValidation;
|
return fmt.needsCliDecoder || fmt.needsHeifDecoder || fmt.mayFailValidation;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimeout(fmt: FormatDef): number | undefined {
|
function getTimeout(fmt: FormatDef, toolId?: string): number | undefined {
|
||||||
return fmt.needsHeifDecoder || fmt.needsCliDecoder ? 180_000 : undefined;
|
if (fmt.needsHeifDecoder || fmt.needsCliDecoder) return 180_000;
|
||||||
|
if (toolId === "image-enhancement") return 120_000;
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -639,7 +641,7 @@ describe("Image enhancement across all 16 primary formats", () => {
|
|||||||
if (!res) return;
|
if (!res) return;
|
||||||
assertDownloadResponse(res, fmt);
|
assertDownloadResponse(res, fmt);
|
||||||
},
|
},
|
||||||
getTimeout(fmt),
|
getTimeout(fmt, "image-enhancement"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -896,7 +898,7 @@ describe("No-crash matrix: 16 formats x 12 tools", () => {
|
|||||||
expect(body.error.length).toBeGreaterThan(0);
|
expect(body.error.length).toBeGreaterThan(0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTimeout(fmt),
|
getTimeout(fmt, tool.id),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -484,7 +484,12 @@ describe("Cross-format matrix", () => {
|
|||||||
// Skip "Convert to PNG" when input is already PNG (no-op conversion)
|
// Skip "Convert to PNG" when input is already PNG (no-op conversion)
|
||||||
if (tool.id === "convert" && fmt.name === "PNG") continue;
|
if (tool.id === "convert" && fmt.name === "PNG") continue;
|
||||||
|
|
||||||
const perTestTimeout = fmt.needsHeifDecoder || fmt.needsCliDecoder ? 180_000 : undefined;
|
const perTestTimeout =
|
||||||
|
fmt.needsHeifDecoder || fmt.needsCliDecoder
|
||||||
|
? 180_000
|
||||||
|
: tool.id === "image-enhancement"
|
||||||
|
? 120_000
|
||||||
|
: undefined;
|
||||||
|
|
||||||
it(
|
it(
|
||||||
`${tool.label}`,
|
`${tool.label}`,
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ describe("Alpha channel preservation", () => {
|
|||||||
|
|
||||||
// ── Large file handling ─────────────────────────────────────────
|
// ── Large file handling ─────────────────────────────────────────
|
||||||
describe("Large file handling", () => {
|
describe("Large file handling", () => {
|
||||||
it("enhances a large stress image", async () => {
|
it("enhances a large stress image", { timeout: 120_000 }, async () => {
|
||||||
const large = readFileSync(join(FIXTURES, "content", "stress-large.jpg"));
|
const large = readFileSync(join(FIXTURES, "content", "stress-large.jpg"));
|
||||||
const res = await postTool(
|
const res = await postTool(
|
||||||
{ mode: "auto", intensity: 50 },
|
{ mode: "auto", intensity: 50 },
|
||||||
@@ -951,7 +951,7 @@ describe("Invalid image data", () => {
|
|||||||
|
|
||||||
// ── Large file with specific modes ──────────────────────────────
|
// ── Large file with specific modes ──────────────────────────────
|
||||||
describe("Large file with modes", () => {
|
describe("Large file with modes", () => {
|
||||||
it("enhances large image in low-light mode", async () => {
|
it("enhances large image in low-light mode", { timeout: 120_000 }, async () => {
|
||||||
const large = readFileSync(join(FIXTURES, "content", "stress-large.jpg"));
|
const large = readFileSync(join(FIXTURES, "content", "stress-large.jpg"));
|
||||||
const res = await postTool(
|
const res = await postTool(
|
||||||
{ mode: "low-light", intensity: 70 },
|
{ mode: "low-light", intensity: 70 },
|
||||||
@@ -964,7 +964,7 @@ describe("Large file with modes", () => {
|
|||||||
expect(result.processedSize).toBeGreaterThan(0);
|
expect(result.processedSize).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("enhances large image in document mode", async () => {
|
it("enhances large image in document mode", { timeout: 120_000 }, async () => {
|
||||||
const large = readFileSync(join(FIXTURES, "content", "stress-large.jpg"));
|
const large = readFileSync(join(FIXTURES, "content", "stress-large.jpg"));
|
||||||
const res = await postTool(
|
const res = await postTool(
|
||||||
{ mode: "document", intensity: 90 },
|
{ mode: "document", intensity: 90 },
|
||||||
|
|||||||
Reference in New Issue
Block a user