fix: 保留 runtime GitOps codeAgentRuntime overlay

This commit is contained in:
Codex
2026-07-14 02:25:06 +02:00
parent 375d049aca
commit 66e3c8a848
4 changed files with 241 additions and 0 deletions
@@ -0,0 +1,46 @@
import { afterEach, expect, test } from "bun:test";
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { runtimeGitopsScriptsConfigMap } from "./runtime-gitops-scripts-configmap.mjs";
const roots: string[] = [];
afterEach(() => {
while (roots.length > 0) rmSync(roots.pop()!, { recursive: true, force: true });
});
test("preserves codeAgentRuntime in the owning runtime GitOps overlay", () => {
const scriptsDir = mkdtempSync(join(tmpdir(), "runtime-gitops-configmap-"));
roots.push(scriptsDir);
for (const name of ["runtime-gitops-observability.mjs", "runtime-gitops-postprocess.mjs", "runtime-gitops-verify.mjs"]) {
writeFileSync(join(scriptsDir, name), `${name}\n`);
}
const codeAgentRuntime = {
enabled: true,
kafkaEventBridge: {
enabled: true,
features: {
directPublish: false,
liveKafkaSse: false,
kafkaRefreshReplay: false,
transactionalProjector: true,
projectionOutboxRelay: true,
projectionRealtime: true,
},
},
};
const configMap = runtimeGitopsScriptsConfigMap({
overlay: { runtimePath: "runtime", observability: { prometheusOperator: false }, codeAgentRuntime },
scriptsDir,
namespace: "hwlab",
configMapName: "runtime-gitops-scripts",
});
expect(JSON.parse(configMap.data["runtime-gitops-overlay.json"])).toEqual({
runtimePath: "runtime",
observability: { prometheusOperator: false },
codeAgentRuntime,
});
});