test: 固化 pika API 配置来源

This commit is contained in:
Codex
2026-07-12 16:31:19 +02:00
parent e202dab312
commit 2ea8c3e981
+41
View File
@@ -986,6 +986,11 @@ describe("AgentRun YAML tool credential binding", () => {
id: secret.id,
sourceMode: secret.sourceMode,
sourceRef: secret.sourceRef,
sourceKey: secret.sourceKey,
sourceFormat: secret.sourceFormat,
transform: secret.transform,
codexConfig: secret.codexConfig,
jsonValue: secret.jsonValue,
sourceProfile: secret.providerCredentialSourceProfile,
effectiveBackendProfile: secret.providerCredentialProfile,
targetRef: secret.targetRef,
@@ -994,6 +999,11 @@ describe("AgentRun YAML tool credential binding", () => {
id: "provider-gpt-pika-auth-json",
sourceMode: "file",
sourceRef: "/root/.codex/auth.json.pika",
sourceKey: null,
sourceFormat: null,
transform: null,
codexConfig: null,
jsonValue: null,
sourceProfile: "gpt.pika",
effectiveBackendProfile: "gpt-pika",
targetRef: { namespace: "agentrun-v02", name: "agentrun-v02-provider-gpt-pika", key: "auth.json" },
@@ -1002,11 +1012,42 @@ describe("AgentRun YAML tool credential binding", () => {
id: "provider-gpt-pika-config",
sourceMode: "file",
sourceRef: "/root/.codex/config.toml.pika",
sourceKey: null,
sourceFormat: null,
transform: null,
codexConfig: null,
jsonValue: null,
sourceProfile: "gpt.pika",
effectiveBackendProfile: "gpt-pika",
targetRef: { namespace: "agentrun-v02", name: "agentrun-v02-provider-gpt-pika", key: "config.toml" },
},
]);
const renderedPikaSources = collectLaneSecretSources(spec).filter((source) => source.providerCredentialSourceProfile === "gpt.pika");
expect(renderedPikaSources.map((source) => ({
id: source.id,
sourceMode: source.sourceMode,
sourceRef: source.sourceRef,
sourceKey: source.sourceKey,
sourceFormat: source.sourceFormat,
transform: source.transform,
codexConfig: source.codexConfig,
jsonValue: source.jsonValue,
sourceProfile: source.providerCredentialSourceProfile,
effectiveBackendProfile: source.providerCredentialProfile,
targetRef: source.targetRef,
}))).toEqual(pikaSecrets.map((secret) => ({
id: secret.id,
sourceMode: secret.sourceMode,
sourceRef: secret.sourceRef,
sourceKey: secret.sourceKey,
sourceFormat: secret.sourceFormat,
transform: secret.transform,
codexConfig: secret.codexConfig,
jsonValue: secret.jsonValue,
sourceProfile: secret.providerCredentialSourceProfile,
effectiveBackendProfile: secret.providerCredentialProfile,
targetRef: secret.targetRef,
})));
const expected = [{
sourceProfile: "gpt.pika",
profile: "gpt-pika",