Skip to content

Commit efe6b37

Browse files
committed
test(parallels): write Windows provider config via batch file
1 parent 4f7286c commit efe6b37

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

scripts/e2e/parallels/powershell.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,20 @@ export function windowsModelProviderTimeoutScript(modelId: string): string {
2020
if (!providerId || !configJson) {
2121
return "";
2222
}
23-
return `Invoke-OpenClaw config set ${psSingleQuote(`models.providers.${providerId}`)} ${psSingleQuote(configJson)} --strict-json
24-
if ($LASTEXITCODE -ne 0) { throw "model provider timeout config set failed" }`;
23+
const batchJson = JSON.stringify([
24+
{
25+
path: `models.providers.${providerId}`,
26+
value: JSON.parse(configJson) as unknown,
27+
},
28+
]);
29+
return `$providerTimeoutBatchPath = Join-Path ([System.IO.Path]::GetTempPath()) 'openclaw-provider-timeout.batch.json'
30+
@'
31+
${batchJson}
32+
'@ | Set-Content -Path $providerTimeoutBatchPath -Encoding UTF8
33+
Invoke-OpenClaw config set --batch-file $providerTimeoutBatchPath --strict-json
34+
$providerTimeoutExit = $LASTEXITCODE
35+
Remove-Item $providerTimeoutBatchPath -Force -ErrorAction SilentlyContinue
36+
if ($providerTimeoutExit -ne 0) { throw "model provider timeout config set failed" }`;
2537
}
2638

2739
export const windowsOpenClawResolver = String.raw`function Resolve-OpenClawCommand {

test/scripts/parallels-smoke-model.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ console.log(JSON.stringify(result));
324324
expect(readFileSync(TS_PATHS.macos, "utf8")).toContain("providerTimeoutConfigJson");
325325
expect(readFileSync(TS_PATHS.linux, "utf8")).toContain("providerTimeoutConfigJson");
326326
expect(readFileSync(TS_PATHS.windows, "utf8")).toContain("windowsModelProviderTimeoutScript");
327+
expect(readFileSync(TS_PATHS.powershell, "utf8")).toContain("config set --batch-file");
327328

328329
const npmUpdateScripts = readFileSync(TS_PATHS.npmUpdateScripts, "utf8");
329330
expect(npmUpdateScripts).toContain("posixAgentWorkspaceScript");

0 commit comments

Comments
 (0)