mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-22 10:25:20 -06:00
fix(qa): stop lifecycle CI failing on reused PGIDs (#123161)
* test(qa): avoid reused PGID lifecycle assertion * test(qa): drop reused PID cleanup fallback
This commit is contained in:
@@ -72,7 +72,6 @@ describe.skipIf(process.platform === "win32")("qa scenario command real POSIX li
|
||||
it("settles within a bound after the leader writes its final result with inherited stdio open", async () => {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "qa-command-settlement-"));
|
||||
const descendantPidPath = path.join(root, "descendant.pid");
|
||||
let descendantPid: number | undefined;
|
||||
spawnMock.mockImplementation((...args: Parameters<NonNullable<typeof actualSpawn.value>>) => {
|
||||
if (!actualSpawn.value) {
|
||||
throw new Error("real spawn unavailable");
|
||||
@@ -102,7 +101,7 @@ describe.skipIf(process.platform === "win32")("qa scenario command real POSIX li
|
||||
env: process.env,
|
||||
timeoutMs: 5_000,
|
||||
});
|
||||
descendantPid = await waitForPidFile(descendantPidPath);
|
||||
await waitForPidFile(descendantPidPath);
|
||||
const startedAt = Date.now();
|
||||
const deadline = new AbortController();
|
||||
const result = await Promise.race([
|
||||
@@ -113,20 +112,15 @@ describe.skipIf(process.platform === "win32")("qa scenario command real POSIX li
|
||||
]).finally(() => deadline.abort());
|
||||
|
||||
expect(Date.now() - startedAt).toBeLessThan(1_500);
|
||||
// The exact result proves cleanup succeeded. A later numeric PID probe can
|
||||
// race PID reuse and inspect an unrelated process.
|
||||
expect(result).toEqual({
|
||||
exitCode: 7,
|
||||
signal: null,
|
||||
stdout: "Docker scheduling finished\ndelayed descendant output\n",
|
||||
stderr: "",
|
||||
});
|
||||
if (descendantPid === undefined) {
|
||||
throw new Error("scenario command descendant did not expose its pid");
|
||||
}
|
||||
await waitForDead(descendantPid);
|
||||
} finally {
|
||||
if (descendantPid && isProcessAlive(descendantPid)) {
|
||||
process.kill(descendantPid, "SIGKILL");
|
||||
}
|
||||
await rm(root, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user