test: move image generation live sweep out of src

This commit is contained in:
Peter Steinberger
2026-04-10 09:43:09 +01:00
parent 4fde879142
commit 56cf1bd40c
3 changed files with 18 additions and 22 deletions

View File

@@ -30,7 +30,7 @@ export type MediaSuiteConfig = {
export const MEDIA_SUITES: Record<MediaSuiteId, MediaSuiteConfig> = {
image: {
id: "image",
testFile: "src/image-generation/runtime.live.test.ts",
testFile: "test/image-generation.runtime.live.test.ts",
providerEnvVar: "OPENCLAW_LIVE_IMAGE_GENERATION_PROVIDERS",
providers: ["fal", "google", "minimax", "openai", "vydra"],
},

View File

@@ -1,18 +1,14 @@
import { describe, expect, it } from "vitest";
import { loadBundledProviderPlugin as loadBundledProviderPluginFromTestHelper } from "../../test/helpers/media-generation/bundled-provider-builders.js";
import { loadBundledProviderPlugin as loadBundledProviderPluginFromTestHelper } from "./helpers/media-generation/bundled-provider-builders.js";
import {
registerProviderPlugin,
requireRegisteredProvider,
} from "../../test/helpers/plugins/provider-registration.js";
import { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
import { collectProviderApiKeys } from "../agents/live-auth-keys.js";
import { isLiveProfileKeyModeEnabled, isLiveTestEnabled } from "../agents/live-test-helpers.js";
import { resolveApiKeyForProvider } from "../agents/model-auth.js";
import { loadConfig, type OpenClawConfig } from "../config/config.js";
import { isTruthyEnvValue } from "../infra/env.js";
import { getShellEnvAppliedKeys, loadShellEnvFallback } from "../infra/shell-env.js";
import { encodePngRgba, fillPixel } from "../media/png-encode.js";
import { getProviderEnvVars } from "../secrets/provider-env-vars.js";
} from "./helpers/plugins/provider-registration.js";
import { resolveOpenClawAgentDir } from "../src/agents/agent-paths.js";
import { collectProviderApiKeys } from "../src/agents/live-auth-keys.js";
import { isLiveProfileKeyModeEnabled, isLiveTestEnabled } from "../src/agents/live-test-helpers.js";
import { resolveApiKeyForProvider } from "../src/agents/model-auth.js";
import { loadConfig, type OpenClawConfig } from "../src/config/config.js";
import {
DEFAULT_LIVE_IMAGE_MODELS,
parseCaseFilter,
@@ -21,7 +17,11 @@ import {
redactLiveApiKey,
resolveConfiguredLiveImageModels,
resolveLiveImageAuthStore,
} from "./live-test-helpers.js";
} from "../src/image-generation/live-test-helpers.js";
import { isTruthyEnvValue } from "../src/infra/env.js";
import { getShellEnvAppliedKeys, loadShellEnvFallback } from "../src/infra/shell-env.js";
import { encodePngRgba, fillPixel } from "../src/media/png-encode.js";
import { getProviderEnvVars } from "../src/secrets/provider-env-vars.js";
const LIVE = isLiveTestEnabled();
const REQUIRE_PROFILE_KEYS =
@@ -32,7 +32,6 @@ const caseFilter = parseCaseFilter(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_CA
const envModelMap = parseProviderModelMap(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_MODELS);
type LiveProviderCase = {
plugin: Parameters<typeof registerProviderPlugin>[0]["plugin"];
pluginId: string;
pluginName: string;
providerId: string;
@@ -48,37 +47,34 @@ type LiveImageCase = {
inputImages?: Array<{ buffer: Buffer; mimeType: string; fileName?: string }>;
};
function loadBundledProviderPlugin(pluginId: string): LiveProviderCase["plugin"] {
function loadBundledProviderPlugin(
pluginId: string,
): ReturnType<typeof loadBundledProviderPluginFromTestHelper> {
return loadBundledProviderPluginFromTestHelper(pluginId);
}
const PROVIDER_CASES: LiveProviderCase[] = [
{
plugin: loadBundledProviderPlugin("fal"),
pluginId: "fal",
pluginName: "fal Provider",
providerId: "fal",
},
{
plugin: loadBundledProviderPlugin("google"),
pluginId: "google",
pluginName: "Google Provider",
providerId: "google",
},
{
plugin: loadBundledProviderPlugin("minimax"),
pluginId: "minimax",
pluginName: "MiniMax Provider",
providerId: "minimax",
},
{
plugin: loadBundledProviderPlugin("openai"),
pluginId: "openai",
pluginName: "OpenAI Provider",
providerId: "openai",
},
{
plugin: loadBundledProviderPlugin("vydra"),
pluginId: "vydra",
pluginName: "Vydra Provider",
providerId: "vydra",
@@ -226,7 +222,7 @@ describeLive("image generation live (provider sweep)", () => {
}
const { imageProviders } = await registerProviderPlugin({
plugin: providerCase.plugin,
plugin: loadBundledProviderPlugin(providerCase.pluginId),
id: providerCase.pluginId,
name: providerCase.pluginName,
});

View File

@@ -21,7 +21,7 @@ export default defineConfig({
disableConsoleIntercept: true,
maxWorkers: 1,
setupFiles: [...new Set([...(baseTest.setupFiles ?? []), "test/setup-openclaw-runtime.ts"])],
include: ["src/**/*.live.test.ts", BUNDLED_PLUGIN_LIVE_TEST_GLOB],
include: ["src/**/*.live.test.ts", "test/**/*.live.test.ts", BUNDLED_PLUGIN_LIVE_TEST_GLOB],
exclude,
},
});