fix: start durable bridge from ConfigMap symlink

This commit is contained in:
Codex
2026-07-11 12:21:27 +02:00
parent b12dd85375
commit 3ba7de2c72
2 changed files with 31 additions and 4 deletions
@@ -1,16 +1,18 @@
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { createHash, createHmac } from "node:crypto";
import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
import { createServer } from "node:http";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
import test from "node:test";
import {
createGithubSyncHandler,
createDurableInboxStore,
createDurableSyncController,
createSyncCoordinator,
isMainModule,
run,
runResult,
syncRepository,
@@ -18,6 +20,22 @@ import {
const zeroDelay = async () => {};
test("main module detection follows Kubernetes ConfigMap symlinks", () => {
const root = mkdtempSync(join(tmpdir(), "gitea-sync-main-"));
try {
const dataDirectory = join(root, "..data");
const source = join(dataDirectory, "server.mjs");
const mounted = join(root, "server.mjs");
mkdirSync(dataDirectory);
writeFileSync(source, "export {};\n", { flag: "wx" });
symlinkSync(join("..data", "server.mjs"), mounted);
assert.equal(isMainModule(mounted, pathToFileURL(source).href), true);
} finally {
rmSync(root, { recursive: true, force: true });
}
});
test("HTTP 202 waits for durable acceptance but does not claim refs are committed", async () => {
const repo = fakeRepo("one");
const logs = [];
@@ -689,7 +707,7 @@ test("git subprocesses fail closed before launch when the shared deadline is exh
test("async process runner handles spawn errors and kills the whole subprocess group at deadline", async () => {
const missing = await runResult(["unidesk-command-that-does-not-exist"], 100);
assert.equal(missing.status, null);
assert.match(missing.stderr, /ENOENT/);
assert.match(missing.stderr, /ENOENT|Executable not found/u);
const root = mkdtempSync(join(tmpdir(), "unidesk-gitea-process-tree-"));
const marker = join(root, "child-survived");