fix: use runtime namespace for session PVCs
This commit is contained in:
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
||||
import { startManagerServer } from "../../mgr/server.js";
|
||||
import { MemoryAgentRunStore } from "../../mgr/store.js";
|
||||
import { ManagerClient } from "../../mgr/client.js";
|
||||
import { createSessionPvc, deleteSessionPvc, getSessionPvcSummary, refreshSessionPvcSummary, runSessionStorageGc, sessionPvcNameFor, sanitizeSessionIdForPvc } from "../../mgr/session-pvc.js";
|
||||
import { buildSessionPvcSpec, createSessionPvc, deleteSessionPvc, getSessionPvcSummary, refreshSessionPvcSummary, runSessionStorageGc, sessionPvcNameFor, sanitizeSessionIdForPvc } from "../../mgr/session-pvc.js";
|
||||
import type { KubectlHandler, SessionPvcOptions } from "../../mgr/session-pvc.js";
|
||||
import type { SelfTestCase } from "../harness.js";
|
||||
|
||||
@@ -35,6 +35,16 @@ const selfTest: SelfTestCase = async () => {
|
||||
assert.equal(sessionPvcNameFor("sess_with_underscores_001"), "agentrun-v01-session-sess-with-underscores-001");
|
||||
assert.equal(sessionPvcNameFor("Sess.UPPER.001"), "agentrun-v01-session-sess-upper-001");
|
||||
assert.equal(sessionPvcNameFor("---"), "agentrun-v01-session-default");
|
||||
const previousRuntimeNamespace = process.env.AGENTRUN_RUNTIME_NAMESPACE;
|
||||
try {
|
||||
delete process.env.AGENTRUN_RUNTIME_NAMESPACE;
|
||||
assert.equal(buildSessionPvcSpec({ sessionId: "sess_default_namespace", options: opts }).namespace, "agentrun-v01");
|
||||
process.env.AGENTRUN_RUNTIME_NAMESPACE = "agentrun-v02";
|
||||
assert.equal(buildSessionPvcSpec({ sessionId: "sess_runtime_namespace", options: opts }).namespace, "agentrun-v02");
|
||||
} finally {
|
||||
if (previousRuntimeNamespace === undefined) delete process.env.AGENTRUN_RUNTIME_NAMESPACE;
|
||||
else process.env.AGENTRUN_RUNTIME_NAMESPACE = previousRuntimeNamespace;
|
||||
}
|
||||
const after = await store.getSession(sessionId);
|
||||
assert.equal(after?.storageKind, "pvc");
|
||||
assert.equal(after?.storagePvcName, summary.pvcName);
|
||||
|
||||
Reference in New Issue
Block a user