test: trim secrets runtime snapshot setup

This commit is contained in:
Shakker 2026-04-03 11:22:40 +01:00 committed by Peter Steinberger
parent 38f76a1f8f
commit d75fa152b9
3 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import {
asConfig,
createOpenAIFileRuntimeConfig,
createOpenAIFileRuntimeFixture,
EMPTY_LOADABLE_PLUGIN_ORIGINS,
expectResolvedOpenAIRuntime,
loadAuthStoreWithProfiles,
OPENAI_ENV_KEY_REF,
@ -73,6 +74,7 @@ describe("secrets runtime snapshot auth integration", () => {
}),
env: { OPENAI_API_KEY: "sk-runtime" },
agentDirs: ["/tmp/openclaw-agent-main"],
loadablePluginOrigins: EMPTY_LOADABLE_PLUGIN_ORIGINS,
loadAuthStore: () =>
loadAuthStoreWithProfiles({
"openai:default": {
@ -106,6 +108,7 @@ describe("secrets runtime snapshot auth integration", () => {
const prepared = await prepareSecretsRuntimeSnapshot({
config: createOpenAIFileRuntimeConfig(secretFile),
agentDirs: [agentDir],
loadablePluginOrigins: EMPTY_LOADABLE_PLUGIN_ORIGINS,
});
activateSecretsRuntimeSnapshot(prepared);
@ -147,6 +150,7 @@ describe("secrets runtime snapshot auth integration", () => {
const prepared = await prepareSecretsRuntimeSnapshot({
config: createOpenAIFileRuntimeConfig(secretFile),
agentDirs: [agentDir],
loadablePluginOrigins: EMPTY_LOADABLE_PLUGIN_ORIGINS,
loadAuthStore,
});
@ -220,6 +224,7 @@ describe("secrets runtime snapshot auth integration", () => {
OPENAI_API_KEY: "sk-main-runtime",
ANTHROPIC_API_KEY: "sk-ops-runtime",
},
loadablePluginOrigins: EMPTY_LOADABLE_PLUGIN_ORIGINS,
});
activateSecretsRuntimeSnapshot(prepared);

View File

@ -12,6 +12,7 @@ import { withTempHome } from "../config/home-env.test-harness.js";
import { captureEnv, withEnvAsync } from "../test-utils/env.js";
import {
asConfig,
EMPTY_LOADABLE_PLUGIN_ORIGINS,
loadAuthStoreWithProfiles,
SECRETS_RUNTIME_INTEGRATION_TIMEOUT_MS,
} from "./runtime.integration.test-helpers.js";
@ -70,6 +71,7 @@ describe("secrets runtime snapshot gateway-auth integration", () => {
}),
env: {},
agentDirs: ["/tmp/openclaw-agent-main"],
loadablePluginOrigins: EMPTY_LOADABLE_PLUGIN_ORIGINS,
loadAuthStore: () => ({ version: 1, profiles: {} }),
}),
).rejects.toThrow(/MISSING_GATEWAY_AUTH_TOKEN/i);
@ -105,6 +107,7 @@ describe("secrets runtime snapshot gateway-auth integration", () => {
GATEWAY_AUTH_TOKEN: "gateway-runtime-token",
},
agentDirs: ["/tmp/openclaw-agent-main"],
loadablePluginOrigins: EMPTY_LOADABLE_PLUGIN_ORIGINS,
loadAuthStore: () => loadAuthStoreWithProfiles({}),
});

View File

@ -4,6 +4,7 @@ import { expect } from "vitest";
import { ensureAuthProfileStore, type AuthProfileStore } from "../agents/auth-profiles.js";
import type { OpenClawConfig } from "../config/config.js";
import { loadConfig } from "../config/config.js";
import type { PluginOrigin } from "../plugins/types.js";
export const OPENAI_ENV_KEY_REF = {
source: "env",
@ -18,6 +19,7 @@ export const OPENAI_FILE_KEY_REF = {
} as const;
export const SECRETS_RUNTIME_INTEGRATION_TIMEOUT_MS = 300_000;
export const EMPTY_LOADABLE_PLUGIN_ORIGINS: ReadonlyMap<string, PluginOrigin> = new Map();
const allowInsecureTempSecretFile = process.platform === "win32";