mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
test: reuse prepared bundled plugins in startup corpus (#148465)
This commit is contained in:
parent
c3842f0ce7
commit
cbc5d7e03c
3 changed files with 23 additions and 3 deletions
|
|
@ -82,6 +82,10 @@ checkout revision. Partial, filtered or unknown plans retain the explicit step;
|
|||
release-gate dispatches retain their separate merge-tree proof. Both state
|
||||
repair passes, all static baseline ratchets and required Node failure aggregation
|
||||
remain unchanged.
|
||||
The corpus uses the normal bundled-plugin resolver to select the prepared
|
||||
runtime from this checkout instead of forcing TypeScript plugin entrypoints.
|
||||
Plugins whose Doctor contracts require source loading retain that behavior;
|
||||
the complete config/state matrix and its assertions remain intact.
|
||||
|
||||
Ordinary pull requests that change only independent Control UI unit-test entries
|
||||
keep all three UI unit rows, performance checks, and existing type/lint gates,
|
||||
|
|
|
|||
|
|
@ -8,10 +8,18 @@ import { acquireReadOnlyPreparedModelRuntime } from "../agents/prepared-model-ru
|
|||
import { applyLegacyCompatibilityStep } from "../commands/doctor/shared/config-flow-steps.js";
|
||||
import { normalizeCompatibilityConfigValues } from "../commands/doctor/shared/legacy-config-core-migrate.js";
|
||||
import { loadGatewayStartupConfigSnapshot } from "../gateway/server-startup-config-helpers.js";
|
||||
import { resolveBundledDirFromPackageRoot } from "../plugins/bundled-dir.js";
|
||||
import { resolveProviderChannelLoginChoice } from "../plugins/provider-login-options.js";
|
||||
import { createConfigIO } from "./io.js";
|
||||
import type { OpenClawConfig } from "./types.js";
|
||||
|
||||
const bundledPluginsDir = resolveBundledDirFromPackageRoot(
|
||||
fileURLToPath(new URL("../../", import.meta.url)),
|
||||
);
|
||||
if (!bundledPluginsDir) {
|
||||
throw new Error("Missing bundled plugin fixtures for startup corpus");
|
||||
}
|
||||
|
||||
const corpusDir = fileURLToPath(new URL("../../test/fixtures/config-corpus/", import.meta.url));
|
||||
const fixtureNames = fs
|
||||
.readdirSync(corpusDir)
|
||||
|
|
@ -107,7 +115,7 @@ describe("operator config startup corpus", () => {
|
|||
OPENCLAW_STATE_DIR: home,
|
||||
DISCORD_BOT_TOKEN: "synthetic-token",
|
||||
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "0",
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: fileURLToPath(new URL("../../extensions/", import.meta.url)),
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledPluginsDir,
|
||||
};
|
||||
const snapshot = await createConfigIO({
|
||||
configPath,
|
||||
|
|
@ -173,7 +181,7 @@ describe("operator config startup corpus", () => {
|
|||
OPENCLAW_TEST_HOME: home,
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
OPENCLAW_CONFIG_PATH: configPath,
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: fileURLToPath(new URL("../../extensions/", import.meta.url)),
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledPluginsDir,
|
||||
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "0",
|
||||
})) {
|
||||
vi.stubEnv(key, value);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { loadCronJobsStore, resolveCronJobsStorePathFromConfig } from "../cron/s
|
|||
import { loadGatewayStartupConfigSnapshot } from "../gateway/server-startup-config-helpers.js";
|
||||
import { runStartupSessionMigration } from "../gateway/server-startup-session-migration.js";
|
||||
import { openNodeSqliteDatabase } from "../infra/node-sqlite.js";
|
||||
import { resolveBundledDirFromPackageRoot } from "../plugins/bundled-dir.js";
|
||||
import {
|
||||
closeOpenClawAgentDatabasesAsync,
|
||||
OPENCLAW_AGENT_SCHEMA_VERSION,
|
||||
|
|
@ -29,6 +30,13 @@ import {
|
|||
} from "./sessions.js";
|
||||
import { loadSessionEntryReadOnly } from "./sessions/session-accessor.js";
|
||||
|
||||
const bundledPluginsDir = resolveBundledDirFromPackageRoot(
|
||||
fileURLToPath(new URL("../../", import.meta.url)),
|
||||
);
|
||||
if (!bundledPluginsDir) {
|
||||
throw new Error("Missing bundled plugin fixtures for startup corpus");
|
||||
}
|
||||
|
||||
type StateFixture = {
|
||||
release: string;
|
||||
sessions: Array<{
|
||||
|
|
@ -83,7 +91,7 @@ function prepareState(release: string, configName: string) {
|
|||
OPENCLAW_TEST_HOME: home,
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
OPENCLAW_CONFIG_PATH: configPath,
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: fileURLToPath(new URL("../../extensions/", import.meta.url)),
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledPluginsDir,
|
||||
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "0",
|
||||
})) {
|
||||
vi.stubEnv(key, value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue