fix(ci): fail gateway CPU spawn errors · openclaw/openclaw@b9f1816
vincentkoc
·
2026-06-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -137,9 +137,22 @@ function runStep(name, command, args, options = {}, params = {}) {
|
137 | 137 | stdio: "inherit", |
138 | 138 | ...options, |
139 | 139 | }); |
140 | | -const status = result.status ?? (result.signal ? 1 : 0); |
141 | | -console.error(`[gateway-cpu] ${status === 0 ? "pass" : "fail"} ${name}`); |
142 | | -return { name, status, signal: result.signal ?? null }; |
| 140 | +const error = |
| 141 | +result.error instanceof Error |
| 142 | + ? result.error.message |
| 143 | + : result.error |
| 144 | + ? String(result.error) |
| 145 | + : null; |
| 146 | +const status = result.error ? 1 : (result.status ?? (result.signal ? 1 : 0)); |
| 147 | +console.error( |
| 148 | +`[gateway-cpu] ${status === 0 ? "pass" : "fail"} ${name}${error ? `: ${error}` : ""}`, |
| 149 | +); |
| 150 | +return { |
| 151 | + name, |
| 152 | + status, |
| 153 | +signal: result.signal ?? null, |
| 154 | + ...(error ? { error } : {}), |
| 155 | +}; |
143 | 156 | } |
144 | 157 | |
145 | 158 | function pnpmCommand(args, params = {}) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -108,6 +108,31 @@ describe("gateway CPU scenario guard", () => {
|
108 | 108 | ]); |
109 | 109 | }); |
110 | 110 | |
| 111 | +it("fails startup build spawn errors and skips the startup bench", async () => { |
| 112 | +const outputDir = makeTempRoot(); |
| 113 | +const calls: string[][] = []; |
| 114 | +const options = testing.parseArgs(["--output-dir", outputDir, "--skip-qa"]); |
| 115 | + |
| 116 | +const result = await testing.runGatewayCpuScenarios(options, { |
| 117 | +silent: true, |
| 118 | +spawnSync: (_command: string, args: string[]) => { |
| 119 | +calls.push(args); |
| 120 | +return { |
| 121 | +error: Object.assign(new Error("spawn ENOENT"), { code: "ENOENT" }), |
| 122 | +signal: null, |
| 123 | +status: null, |
| 124 | +}; |
| 125 | +}, |
| 126 | +}); |
| 127 | + |
| 128 | +expect(result.exitCode).toBe(1); |
| 129 | +expect(calls).toEqual([["scripts/ensure-cli-startup-build.mjs"]]); |
| 130 | +expect(result.summary.steps).toEqual([ |
| 131 | +{ name: "startup build", error: "spawn ENOENT", signal: null, status: 1 }, |
| 132 | +{ name: "startup bench", signal: null, status: 1 }, |
| 133 | +]); |
| 134 | +}); |
| 135 | + |
111 | 136 | it("prebuilds private QA dist before running QA scenarios when it is missing", async () => { |
112 | 137 | const cwd = makeTempRoot(); |
113 | 138 | const outputDir = path.join(cwd, "out"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。