Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Tests: a preview's ffmpeg tries and the worker setup have time on a busy machine

Adarsh45be1335880e
diff --git a/tests/worker-parts.test.ts b/tests/worker-parts.test.ts
index 9747023c..bbd49c7c 100644
--- a/tests/worker-parts.test.ts
+++ b/tests/worker-parts.test.ts
@@ -20,6 +20,8 @@ import { tempDir } from "./helpers/temp-dir";
const hasFfmpeg = spawnSync("ffmpeg", ["-hide_banner", "-version"]).status === 0;
/** A check that starts the real ffmpeg (several times, for a preview): time for a busy machine running other tests too. */
const FFMPEG_MS = 60_000;
+/** Each of a preview's tries, on a busy machine (ffmpeg runs at low priority): the check waits for every try. */
+const PREVIEW_TRY_MS = 30_000;
/** A clock that moves only when the policy sleeps. */
function clock() {
@@ -262,11 +264,11 @@ describe("clips and sound, made again", () => {
const png = path.join(dir, "preview.png");
const made = spawnSync("ffmpeg", ["-hide_banner", "-loglevel", "error", "-f", "lavfi", "-i", "testsrc=size=768x512", "-frames:v", "1", png]);
expect(made.status).toBe(0);
- const out = await previewJpeg({ ffmpeg: "ffmpeg", data: new Uint8Array(fs.readFileSync(png)), type: "image/png" });
+ const out = await previewJpeg({ ffmpeg: "ffmpeg", data: new Uint8Array(fs.readFileSync(png)), type: "image/png", timeoutMs: PREVIEW_TRY_MS });
expect(out).not.toBeNull();
expect([...out!.subarray(0, 3)]).toEqual([0xff, 0xd8, 0xff]);
expect(out!.length).toBeLessThanOrEqual(64 * 1024);
- }, FFMPEG_MS);
+ }, PREVIEW_QUALITIES.length * PREVIEW_TRY_MS + FFMPEG_MS);
it.runIf(hasFfmpeg)("ffmpeg refuses a playlist that names another file on this PC, and makes a plain clip again", async () => {
const dir = tempDir("fuobe-worker-playlist-");
diff --git a/tests/worker-program.test.ts b/tests/worker-program.test.ts
index 6c8b9002..09dc4947 100644
--- a/tests/worker-program.test.ts
+++ b/tests/worker-program.test.ts
@@ -157,6 +157,7 @@ describe("cleanup (check 13) and setup", () => {
expect(syncedFolder("D:\\FuobeWorker")).toBe(false);
});
+ // Each setup asks ffmpeg for its version: 60 s, for a busy machine running other tests too.
it("setup again keeps a port pinned by hand and the rest of worker.json, drops the older setups' 8190, and adds no defaults", async () => {
const setupWith = async (saved: Record<string, unknown>) => {
const home = tempDir("fuobe-worker-setup-home-");
@@ -173,7 +174,7 @@ describe("cleanup (check 13) and setup", () => {
for (const key of ["hungMin", "busyVramMb", "localComfyPorts", "allowHttpSite"]) expect(kept).not.toHaveProperty(key);
expect((await setupWith({ port: 8190 })).port).toBeNull();
expect((await setupWith({})).port).toBeNull();
- });
+ }, 60_000);
it("hashes its inventory the way the studio does", async () => {
const { inventoryHash } = await import("@/server/computer/pool");