fix: shorten session PVC label values
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 { buildSessionPvcSpec, createSessionPvc, deleteSessionPvc, getSessionPvcSummary, refreshSessionPvcSummary, runSessionStorageGc, sessionPvcNameFor, sanitizeSessionIdForPvc } from "../../mgr/session-pvc.js";
|
||||
import { buildSessionPvcSpec, createSessionPvc, deleteSessionPvc, getSessionPvcSummary, refreshSessionPvcSummary, runSessionStorageGc, sessionPvcLabelValueFor, 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,11 @@ 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 longSessionId = "ses_agentrun_dsflash_go_0606efb7_60fd_4f38_9532_398b46e54808-reset-trcmqlrsnc2r";
|
||||
const longSessionLabel = sessionPvcLabelValueFor(longSessionId);
|
||||
assert.ok(longSessionLabel.length <= 63);
|
||||
assert.notEqual(longSessionLabel, longSessionId);
|
||||
assert.match(longSessionLabel, /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/u);
|
||||
const previousRuntimeNamespace = process.env.AGENTRUN_RUNTIME_NAMESPACE;
|
||||
try {
|
||||
delete process.env.AGENTRUN_RUNTIME_NAMESPACE;
|
||||
|
||||
Reference in New Issue
Block a user