mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-29 17:01:17 +00:00
* refactor(plugins): trim activation and contract exports * test(plugins): restore fixture cleanup * refactor(plugins): trim install and loader exports * test(plugins): fully reset loader caches * refactor(plugins): trim metadata and catalog exports * test(plugins): preserve catalog trust coverage * refactor(plugins): trim provider and plugin exports * refactor(plugins): trim runtime and tool exports * test(plugins): update dead-export consumers * test(plugins): remove empty dead-export suites * refactor(plugins): align exports with split registry * refactor(plugins): trim drifted loader exports * style(plugins): format test fixtures * refactor(scripts): use supported plugin APIs * refactor(plugins): finish dead export cleanup * chore(deadcode): refresh export baseline * test(cli): mock production memory state * chore(deadcode): sync latest export baseline * fix(tests): keep plugin fixtures inside core * chore(deadcode): refresh rebased export baseline * chore(deadcode): sync current ratchets * fix(plugins): retain reserved slot invariant * fix(plugins): preserve dead-export invariants * test(plugins): use neutral catalog query fixture * test(plugins): satisfy catalog lint * test(plugins): preserve integrity drift coverage * fix(ci): register skill experience live proof
46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
/** Integration-test helpers for preparing secrets runtime fixtures. */
|
|
import { vi } from "vitest";
|
|
import { clearConfigCache, clearRuntimeConfigSnapshot } from "../config/config.js";
|
|
import { clearPluginLoaderCache } from "../plugins/loader.test-fixtures.js";
|
|
import { captureEnv } from "../test-utils/env.js";
|
|
import type { SecretsRuntimeEnvSnapshot } from "./runtime-openai-file-fixture.test-helper.js";
|
|
|
|
/** Shared integration helpers for full secrets runtime snapshot tests. */
|
|
export {
|
|
asConfig,
|
|
createOpenAIFileRuntimeConfig,
|
|
createOpenAIFileRuntimeFixture,
|
|
EMPTY_LOADABLE_PLUGIN_ORIGINS,
|
|
expectResolvedOpenAIRuntime,
|
|
loadAuthStoreWithProfiles,
|
|
OPENAI_ENV_KEY_REF,
|
|
OPENAI_FILE_KEY_REF,
|
|
} from "./runtime-openai-file-fixture.test-helper.js";
|
|
export type { SecretsRuntimeEnvSnapshot } from "./runtime-openai-file-fixture.test-helper.js";
|
|
import { clearSecretsRuntimeSnapshot } from "./runtime.js";
|
|
|
|
/** Slow integration timeout used by plugin-origin and gateway-auth runtime tests. */
|
|
export const SECRETS_RUNTIME_INTEGRATION_TIMEOUT_MS = 300_000;
|
|
|
|
/** Start an isolated secrets runtime integration test with bundled plugin env removed. */
|
|
export function beginSecretsRuntimeIsolationForTest(): SecretsRuntimeEnvSnapshot {
|
|
const envSnapshot = captureEnv([
|
|
"OPENCLAW_BUNDLED_PLUGINS_DIR",
|
|
"OPENCLAW_DISABLE_BUNDLED_PLUGINS",
|
|
"OPENCLAW_VERSION",
|
|
]);
|
|
delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
|
delete process.env.OPENCLAW_VERSION;
|
|
return envSnapshot;
|
|
}
|
|
|
|
/** Restore env, mocks, config/plugin caches, and active secrets runtime state. */
|
|
export function endSecretsRuntimeIsolationForTest(envSnapshot: SecretsRuntimeEnvSnapshot) {
|
|
vi.restoreAllMocks();
|
|
envSnapshot.restore();
|
|
clearSecretsRuntimeSnapshot();
|
|
clearRuntimeConfigSnapshot();
|
|
clearConfigCache();
|
|
clearPluginLoaderCache();
|
|
}
|