diff --git a/scripts/install.test.ts b/scripts/install.test.ts index 82203b3..4bf1fc1 100644 --- a/scripts/install.test.ts +++ b/scripts/install.test.ts @@ -5,6 +5,7 @@ import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { spawnSync } from "node:child_process"; +// Shell fixtures start several processes; allow headroom on a busy host. const fixtures: string[] = []; afterEach(() => { for (const root of fixtures.splice(0)) rmSync(root, { recursive: true, force: true }); }); const hash = (data: Buffer | string) => createHash("sha256").update(data).digest("hex"); @@ -63,7 +64,7 @@ if [ -n "$dest" ]; then cp "$file" "$dest"; else cat "$file"; fi const run = (env: Record = {}) => spawnSync("bash", [resolve(import.meta.dir, "install.sh")], { cwd: root, env: { ...process.env, PATH: `${tools}:${process.env.PATH}`, HOSE_USE_INSTALL_DIR: target, HOSE_USE_VERSION: "9.9.9", HOSE_USE_MIRROR: "auto", HOSE_FIXTURE_SOURCE: source, HOSE_FIXTURE_LOG: join(root, "skill.log"), HOSE_FIXTURE_REQUESTS: join(root, "requests.log"), ...env }, - encoding: "utf8", timeout: 10_000, + encoding: "utf8", timeout: 30_000, }); return { root, source, target, run, binary }; } @@ -77,7 +78,7 @@ describe("verified standalone installer", () => { expect(readlinkSync(join(f.target, "hose-aipro"))).toBe("hose-use"); expect(readFileSync(join(f.root, "skill.log"), "utf8").trim()).toBe("skill install --yes"); expect(readdirSync(f.target).sort()).toEqual(["hose-aipro", "hose-use"]); - }); + }, 60_000); for (const options of [{ badHash: true }, { missingEntry: true }, { duplicate: true }]) { test(`rejects an invalid manifest/archive and preserves the old binary: ${JSON.stringify(options)}`, () => { @@ -89,7 +90,7 @@ describe("verified standalone installer", () => { expect(result.status).toBe(1); expect(readFileSync(join(f.target, "hose-use"), "utf8")).toBe("old binary"); expect(existsSync(join(f.root, "skill.log"))).toBe(false); - }); + }, 60_000); } test("does not silently bypass missing checksums or guess an old tag", () => { @@ -100,7 +101,7 @@ describe("verified standalone installer", () => { expect(unknown.stderr).toContain("could not resolve"); expect(existsSync(join(f.target, "hose-use"))).toBe(false); expect(readFileSync(join(f.root, "requests.log"), "utf8")).not.toContain("v0.8.9"); - }); + }, 60_000); test("uses a verified raw fallback and a fixed tag when the first mirror fails", () => { const f = fixture({ rawOnly: true }); @@ -110,7 +111,7 @@ describe("verified standalone installer", () => { const requests = readFileSync(join(f.root, "requests.log"), "utf8"); expect(requests).toContain("/download/v9.9.9/"); expect(requests).not.toContain("/latest/download/"); - }); + }, 60_000); test("reports Skill failure without claiming it was installed", () => { const f = fixture(); @@ -119,7 +120,7 @@ describe("verified standalone installer", () => { expect(result.stderr).toContain("binary installed"); expect(result.stdout).not.toContain("Agent skill installed"); expect(result.stdout).not.toContain("successfully installed"); - }); + }, 60_000); test("does not replace directories or follow an existing alias into a directory", () => { const f = fixture(); @@ -133,5 +134,5 @@ describe("verified standalone installer", () => { writeFileSync(join(f.target, "hose-use"), "old binary"); expect(f.run().status).toBe(1); expect(readFileSync(join(f.target, "hose-use"), "utf8")).toBe("old binary"); - }); + }, 60_000); }); diff --git a/scripts/release-validation.test.ts b/scripts/release-validation.test.ts index 85bb8f0..0899a7e 100644 --- a/scripts/release-validation.test.ts +++ b/scripts/release-validation.test.ts @@ -8,6 +8,7 @@ import { parse } from "yaml"; import { bumpVersion } from "./bump-version.js"; import { verifyReleaseTag } from "./verify-release.js"; +// Shell fixtures start several processes; allow headroom on a busy host. const roots: string[] = []; afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }); }); @@ -72,7 +73,7 @@ esac `, { mode: 0o755 }); const workflow = parse(readFileSync(join(import.meta.dir, "../.github/workflows/release.yml"), "utf8")); const step = workflow.jobs["build-and-publish"].steps.find((s: { name?: string }) => s.name === "Publish Gitea Release"); - return { ...f, files, run: () => spawnSync("bash", ["-eo", "pipefail", "-c", step.run], { cwd: f.root, env: { ...process.env, PATH: `${tools}:${process.env.PATH}`, GITEA_TOKEN: "fixture", GITEA_RETRY_DELAY: "0", GITEA_HOST: "https://example.test", GITEA_REPO: "test/repo", RELEASE_TAG: "v1.0.0", MIRROR_ONLY: String(mirrorOnly), GITHUB_REPOSITORY: "test/repo", MIRROR_FIXTURE: f.root, MIRROR_MODE: mode }, encoding: "utf8", timeout: 5000 }) }; + return { ...f, files, run: () => spawnSync("bash", ["-eo", "pipefail", "-c", step.run], { cwd: f.root, env: { ...process.env, PATH: `${tools}:${process.env.PATH}`, GITEA_TOKEN: "fixture", GITEA_RETRY_DELAY: "0", GITEA_HOST: "https://example.test", GITEA_REPO: "test/repo", RELEASE_TAG: "v1.0.0", MIRROR_ONLY: String(mirrorOnly), GITHUB_REPOSITORY: "test/repo", MIRROR_FIXTURE: f.root, MIRROR_MODE: mode }, encoding: "utf8", timeout: 30_000 }) }; } describe("release preparation and publication guards", () => { @@ -86,7 +87,7 @@ describe("release preparation and publication guards", () => { for (const version of ["1.0.0", "0.9.9", "1.0.01", "1.0.1-rc.01", "invalid"]) expect(() => bumpVersion(f.root, version, () => {})).toThrow(); expect(f.version()).toBe("1.0.0"); expect(f.git("status", "--porcelain")).toBe(""); - }); + }, 60_000); test("bump updates sources on its release branch and explicitly invokes regeneration", () => { const f = repository(); @@ -97,7 +98,7 @@ describe("release preparation and publication guards", () => { expect(f.version()).toBe("1.0.1"); expect(readFileSync(join(f.root, "skills/hose-use/SKILL.md"), "utf8")).toContain("version: 1.0.1"); expect(parse(readFileSync(join(f.root, "specs/openapi/openapi.yaml"), "utf8")).info.version).toBe("1.0.1"); - }); + }, 60_000); test("an existing release tag cannot be reused during bump", () => { const f = repository(); @@ -105,7 +106,7 @@ describe("release preparation and publication guards", () => { f.git("tag", "v1.0.1"); expect(() => bumpVersion(f.root, "patch", () => {})).toThrow("already exists"); expect(f.version()).toBe("1.0.0"); - }); + }, 60_000); test("publication validates the actual HEAD, main ancestry and package version", () => { const f = repository(); @@ -120,7 +121,7 @@ describe("release preparation and publication guards", () => { expect(() => verifyReleaseTag(f.root, "v1.0.0")).toThrow("exact tagged commit"); f.git("tag", "v1.0.1"); expect(() => verifyReleaseTag(f.root, "v1.0.1")).toThrow("ancestor"); - }); + }, 60_000); test("workflows validate committed versions before generation and ship the checksum manifest", () => { const root = join(import.meta.dir, ".."); @@ -140,7 +141,7 @@ describe("release preparation and publication guards", () => { for (const name of ["Compile multi-target binaries", "Package release archives", "Publish GitHub Release"]) { expect(steps.find((s: { name?: string }) => s.name === name).if).toBe("${{ !inputs.mirror_only }}"); } - }); + }, 60_000); test("a failed background Gitea upload makes the Release step fail", () => { const f = repository(); @@ -159,11 +160,11 @@ for arg in "$@"; do done exit 22 `, { mode: 0o755 }); - const result = spawnSync("bash", ["-eo", "pipefail", "-c", step.run], { cwd: f.root, env: { ...process.env, PATH: `${join(f.root, "tools")}:${process.env.PATH}`, GITEA_TOKEN: "fixture", GITEA_RETRY_DELAY: "0", GITEA_HOST: "https://example.test", GITEA_REPO: "test/repo", RELEASE_TAG: "v1.0.0" }, encoding: "utf8", timeout: 5000 }); + const result = spawnSync("bash", ["-eo", "pipefail", "-c", step.run], { cwd: f.root, env: { ...process.env, PATH: `${join(f.root, "tools")}:${process.env.PATH}`, GITEA_TOKEN: "fixture", GITEA_RETRY_DELAY: "0", GITEA_HOST: "https://example.test", GITEA_REPO: "test/repo", RELEASE_TAG: "v1.0.0" }, encoding: "utf8", timeout: 30_000 }); expect(result.status).toBe(1); expect(result.stdout).toContain("assets failed to upload"); expect(result.stdout).not.toContain("Successfully published"); - }); + }, 60_000); test("transient asset upload failures are retried", () => { const f = mirrorFixture("retry"); @@ -171,20 +172,20 @@ exit 22 expect(result.status).toBe(0); for (const name of f.files) expect(readFileSync(join(f.root, `count-${name}`), "utf8")).toBe("2"); expect(result.stdout).toContain("attempt 2/3"); - }); + }, 60_000); test("correct mirror assets are verified and retained without uploading replacements", () => { const f = mirrorFixture("skip"); const result = f.run(); expect(result.status).toBe(0); expect(result.stdout.match(/already matches SHA-256/g)).toHaveLength(f.files.length); - }); + }, 60_000); test("mirror-only recovery downloads and verifies the existing GitHub assets", () => { const f = mirrorFixture("skip", true); expect(f.run().status).toBe(0); expect(readFileSync(join(f.root, "gh.log"), "utf8")).toContain("release download v1.0.0"); - }); + }, 60_000); test("asset transfers never exceed two concurrent workers", () => { const f = mirrorFixture("concurrency"); @@ -196,5 +197,5 @@ exit 22 } expect(active).toBe(0); expect(peak).toBeLessThanOrEqual(2); - }); + }, 60_000); });