test: harden release live probes

This commit is contained in:
Peter Steinberger
2026-05-02 10:22:32 +01:00
parent 5b2a0fbac1
commit 800a33bbfe
2 changed files with 48 additions and 17 deletions

View File

@@ -31,6 +31,11 @@ const describeLive = LIVE ? describe : describe.skip;
const providerFilter = parseCsvFilter(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_PROVIDERS);
const caseFilter = parseCaseFilter(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_CASES);
const envModelMap = parseProviderModelMap(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_MODELS);
const DEFAULT_LIVE_IMAGE_GENERATION_TIMEOUT_MS = 120_000;
const LIVE_IMAGE_GENERATION_TIMEOUT_MS = resolvePositiveIntegerEnv(
process.env.OPENCLAW_LIVE_IMAGE_GENERATION_TIMEOUT_MS,
DEFAULT_LIVE_IMAGE_GENERATION_TIMEOUT_MS,
);
type LiveProviderCase = {
pluginId: string;
@@ -48,6 +53,14 @@ type LiveImageCase = {
inputImages?: Array<{ buffer: Buffer; mimeType: string; fileName?: string }>;
};
function resolvePositiveIntegerEnv(raw: string | undefined, fallback: number): number {
if (!raw) {
return fallback;
}
const parsed = Number(raw);
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
}
function loadBundledProviderPlugin(
pluginId: string,
): ReturnType<typeof loadBundledProviderPluginFromTestHelper> {
@@ -255,7 +268,7 @@ describeLive("image generation live (provider sweep)", () => {
size: testCase.size,
resolution: testCase.resolution,
inputImages: testCase.inputImages,
timeoutMs: 60_000,
timeoutMs: LIVE_IMAGE_GENERATION_TIMEOUT_MS,
});
expect(result.images.length).toBeGreaterThan(0);
@@ -293,6 +306,6 @@ describeLive("image generation live (provider sweep)", () => {
}
expect(failures).toEqual([]);
},
10 * 60_000,
15 * 60_000,
);
});