mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-23 02:08:09 +00:00
test(models): stabilize plugin auth marker fixtures (#92652)
Stabilizes model auth marker tests against the current manifest-metadata discovery seam and isolated Vitest environment. Runtime behavior is unchanged; provider-owned non-secret markers remain declared in plugin manifests.
This commit is contained in:
committed by
GitHub
parent
f78d7b52d8
commit
c9c19a1106
@@ -2,9 +2,11 @@
|
||||
* Regression coverage for non-secret model-auth marker helpers.
|
||||
* Verifies core, plugin, env-var, OAuth, AWS, and secret-ref marker handling.
|
||||
*/
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { withEnv, withEnvAsync } from "../test-utils/env.js";
|
||||
|
||||
const BUNDLED_PLUGINS_DIR = fileURLToPath(new URL("../../extensions/", import.meta.url));
|
||||
const PLUGIN_MANIFEST_ENV_KEYS = [
|
||||
"OPENCLAW_BUNDLED_PLUGINS_DIR",
|
||||
"OPENCLAW_DISABLE_BUNDLED_PLUGINS",
|
||||
@@ -14,9 +16,12 @@ const PLUGIN_MANIFEST_ENV_KEYS = [
|
||||
"OPENCLAW_TEST_MINIMAL_GATEWAY",
|
||||
] as const;
|
||||
|
||||
function cleanPluginManifestEnv(): Record<(typeof PLUGIN_MANIFEST_ENV_KEYS)[number], undefined> {
|
||||
function cleanPluginManifestEnv(): Record<
|
||||
(typeof PLUGIN_MANIFEST_ENV_KEYS)[number],
|
||||
string | undefined
|
||||
> {
|
||||
return {
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: undefined,
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: BUNDLED_PLUGINS_DIR,
|
||||
OPENCLAW_DISABLE_BUNDLED_PLUGINS: undefined,
|
||||
OPENCLAW_SKIP_PROVIDERS: undefined,
|
||||
OPENCLAW_SKIP_CHANNELS: undefined,
|
||||
@@ -35,6 +40,7 @@ let listKnownNonSecretApiKeyMarkers: typeof import("./model-auth-markers.js").li
|
||||
let resolveOAuthApiKeyMarker: typeof import("./model-auth-markers.js").resolveOAuthApiKeyMarker;
|
||||
|
||||
async function loadMarkerModules() {
|
||||
vi.doUnmock("../plugins/manifest-metadata-scan.js");
|
||||
vi.doUnmock("../plugins/manifest-registry.js");
|
||||
vi.doUnmock("../secrets/provider-env-vars.js");
|
||||
vi.resetModules();
|
||||
|
||||
@@ -29,6 +29,19 @@ vi.mock("../plugins/plugin-registry.js", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/manifest-metadata-scan.js", () => ({
|
||||
listOpenClawPluginManifestMetadata: () => [
|
||||
{
|
||||
pluginDir: "/bundled/anthropic-vertex",
|
||||
origin: "bundled",
|
||||
manifest: {
|
||||
id: "anthropic-vertex",
|
||||
nonSecretAuthMarkers: ["gcp-vertex-credentials"],
|
||||
},
|
||||
},
|
||||
],
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/providers.js", () => ({
|
||||
resolveOwningPluginIdsForProvider: () => [],
|
||||
resolveOwningPluginIdsForProviderRef: () => [],
|
||||
|
||||
Reference in New Issue
Block a user