@@ -473,11 +473,12 @@ describe("install-sh smoke runner", () => {
|
473 | 473 | const script = readFileSync(SMOKE_RUNNER_PATH, "utf8"); |
474 | 474 | |
475 | 475 | expect(script).toContain( |
476 | | -'HEARTBEAT_INTERVAL="${OPENCLAW_INSTALL_SMOKE_HEARTBEAT_INTERVAL:-60}"', |
| 476 | +'HEARTBEAT_INTERVAL="$(read_nonnegative_int_env OPENCLAW_INSTALL_SMOKE_HEARTBEAT_INTERVAL 60)"', |
477 | 477 | ); |
478 | 478 | expect(script).toContain( |
479 | | -'INSTALL_COMMAND_TIMEOUT="${OPENCLAW_INSTALL_SMOKE_COMMAND_TIMEOUT:-900}"', |
| 479 | +'INSTALL_COMMAND_TIMEOUT="$(read_positive_int_env OPENCLAW_INSTALL_SMOKE_COMMAND_TIMEOUT 900)"', |
480 | 480 | ); |
| 481 | +expect(script).toContain('if [[ "$interval" == "0" ]]; then'); |
481 | 482 | expect(script).toContain("run_with_heartbeat"); |
482 | 483 | expect(script).toContain("npm_install_global"); |
483 | 484 | expect(script).toContain('timeout --kill-after=30s "${INSTALL_COMMAND_TIMEOUT}s"'); |
@@ -491,6 +492,23 @@ describe("install-sh smoke runner", () => {
|
491 | 492 | expect(script).toContain("unterminated update JSON object"); |
492 | 493 | }); |
493 | 494 | |
| 495 | +it.each([ |
| 496 | +["command timeout", "OPENCLAW_INSTALL_SMOKE_COMMAND_TIMEOUT", "900s"], |
| 497 | +["heartbeat interval", "OPENCLAW_INSTALL_SMOKE_HEARTBEAT_INTERVAL", "60s"], |
| 498 | +])("rejects invalid install smoke %s before running npm", (_label, envName, value) => { |
| 499 | +const result = spawnSync("bash", [SMOKE_RUNNER_PATH], { |
| 500 | +encoding: "utf8", |
| 501 | +env: { |
| 502 | + ...process.env, |
| 503 | +[envName]: value, |
| 504 | +}, |
| 505 | +}); |
| 506 | + |
| 507 | +expect(result.status).toBe(2); |
| 508 | +expect(result.stderr).toContain(`invalid ${envName}: ${value}`); |
| 509 | +expect(result.stderr).not.toContain("unsupported OPENCLAW_INSTALL_SMOKE_MODE"); |
| 510 | +}); |
| 511 | + |
494 | 512 | it("covers plain npm global installs and npm-driven updates", () => { |
495 | 513 | const script = readFileSync(SCRIPT_PATH, "utf8"); |
496 | 514 | const runner = readFileSync(SMOKE_RUNNER_PATH, "utf8"); |
|