test(engine): the browser cache and remote tail tests pass the same on any machine (#8557)

This commit is contained in:
Miguel Ángel
2026-11-23 03:10:32 +00:00
committed by GitHub
parent a50baed348
commit da7faad396
2 changed files with 16 additions and 2 deletions
@@ -1,6 +1,6 @@
// fallow-ignore-file code-duplication
import { _resetChromeSandboxFallbackForTests } from "@hyperframes/core/chrome-sandbox";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { execFileSync } from "node:child_process";
import { EventEmitter } from "node:events";
import { chmodSync, existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
@@ -1298,6 +1298,14 @@ function resolveHeadlessShellInSubprocess(
describe("resolveHeadlessShellPath", () => {
const originalHeadlessShellPath = process.env.PRODUCER_HEADLESS_SHELL_PATH;
const originalHyperframesBrowserPath = process.env.HYPERFRAMES_BROWSER_PATH;
// Ubuntu's umask 002 makes these fake caches group-writable, which the cache check refuses.
let originalUmask = 0;
beforeAll(() => {
originalUmask = process.umask(0o022);
});
afterAll(() => {
process.umask(originalUmask);
});
// A runner may export either var (the Windows job sets HYPERFRAMES_BROWSER_PATH); each case sets its own.
beforeEach(() => {
@@ -5,7 +5,13 @@ import type { AddressInfo } from "node:net";
import { tmpdir } from "node:os";
import { usableCpuCount } from "./systemMemory.js";
import { join } from "node:path";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
// Four CPUs everywhere: extraction gets 2 slots, so tail reads beyond them show on any host.
vi.mock("./systemMemory.js", async (importOriginal) => ({
...(await importOriginal<typeof import("./systemMemory.js")>()),
usableCpuCount: () => 4,
}));
import type { VideoElement } from "../types.js";
import { getFfmpegBinary } from "../utils/ffmpegBinaries.js";
import { declareContentAddressedUrl } from "../utils/ffprobe.js";