fix(e2e): avoid stale Crabbox recorder waits · openclaw/openclaw@00c2dc6
vincentkoc
·
2026-06-20
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -411,4 +411,43 @@ setInterval(() => {}, 1000);
|
411 | 411 | const recorderPid = Number.parseInt(fs.readFileSync(recorderPidPath, "utf8"), 10); |
412 | 412 | await waitFor(() => !isProcessAlive(recorderPid)); |
413 | 413 | }); |
| 414 | + |
| 415 | +posixIt( |
| 416 | +"does not wait forever when Crabbox recording exits before the probe returns", |
| 417 | +async () => { |
| 418 | +const root = makeTempDir(); |
| 419 | +const recorderPath = path.join(root, "fake-crabbox-recorder.mjs"); |
| 420 | +const recorderExitPath = path.join(root, "recorder.exit"); |
| 421 | +writeExecutable( |
| 422 | +recorderPath, |
| 423 | +`#!/usr/bin/env node |
| 424 | +import fs from "node:fs"; |
| 425 | + |
| 426 | +fs.writeFileSync(${JSON.stringify(recorderExitPath)}, "exited"); |
| 427 | +`, |
| 428 | +); |
| 429 | + |
| 430 | +await expect( |
| 431 | +Promise.race([ |
| 432 | +recordProbeVideo({ |
| 433 | +crabboxBin: recorderPath, |
| 434 | +cwd: root, |
| 435 | +durationSeconds: 1, |
| 436 | +leaseId: "cbx_test", |
| 437 | +outputPath: path.join(root, "proof.mp4"), |
| 438 | +provider: "aws", |
| 439 | +runProbe: async () => { |
| 440 | +await waitFor(() => fs.existsSync(recorderExitPath)); |
| 441 | +await delay(50); |
| 442 | +}, |
| 443 | +startDelayMs: 0, |
| 444 | +target: "linux", |
| 445 | +}), |
| 446 | +delay(2_000).then(() => { |
| 447 | +throw new Error("recordProbeVideo hung after the recorder had already exited"); |
| 448 | +}), |
| 449 | +]), |
| 450 | +).resolves.toBeUndefined(); |
| 451 | +}, |
| 452 | +); |
414 | 453 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。