mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 11:13:21 +00:00
test(cli): publish polled readiness files only when complete (#10563)
The doctor cancellation fixture wrote its readiness JSON with writeFileSync, which truncates and then writes. The test polls only for the file's existence, so a read between the two steps parsed an empty file and failed with "Unexpected end of JSON input" (main run 43604752864, PR run 43606296871). Write to a pending path and rename it into place, as ghidraJavaDoctor and darwinProcessRunTokenReader fixtures already do. Apply the same fix to the two sibling fixtures that poll for a PID file's existence and then parse it: jadxConfiguration and runnerCancellation, where an empty read becomes PID 0.
This commit is contained in:
1 parent
3fbdf0057b
commit
dfad81a48b
3 files changed
+9
-3
No files matched your search
@@ -508,7 +508,9 @@ const check = setInterval(() => {
|
||||
}
|
||||
}, 10);
|
||||
const watchdog = setTimeout(() => { process.exitCode = 99; clearInterval(check); }, 10000);
|
||||
fs.writeFileSync(ready, String(process.pid));
|
||||
// The test polls for this path; publish only the complete PID by renaming.
|
||||
fs.writeFileSync(ready + ".pending", String(process.pid));
|
||||
fs.renameSync(ready + ".pending", ready);
|
||||
`,
|
||||
);
|
||||
await chmod(java, 0o700);
|
||||
|
||||
@@ -46,7 +46,9 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform)).for(
|
||||
executable,
|
||||
`#!${process.execPath}
|
||||
if (!process.argv.slice(2).includes(${JSON.stringify(probeArgument)})) process.exit(7);
|
||||
require("node:fs").writeFileSync(${JSON.stringify(ready)}, JSON.stringify({pid: process.pid, runId: process.env.REA_PROCESS_RUN_ID, at: Date.now()}));
|
||||
// The test polls for this path; publish only complete JSON by renaming.
|
||||
require("node:fs").writeFileSync(${JSON.stringify(`${ready}.pending`)}, JSON.stringify({pid: process.pid, runId: process.env.REA_PROCESS_RUN_ID, at: Date.now()}));
|
||||
require("node:fs").renameSync(${JSON.stringify(`${ready}.pending`)}, ${JSON.stringify(ready)});
|
||||
process.on("SIGTERM", () => {});
|
||||
setInterval(() => { if (require("node:fs").existsSync(${JSON.stringify(release)})) process.exit(0); }, 25).unref();
|
||||
setTimeout(() => process.exit(99), 20000);
|
||||
|
||||
@@ -51,7 +51,9 @@ it.runIf(process.platform !== "win32")(
|
||||
const fs = require("node:fs");
|
||||
process.on("SIGTERM", () => {});
|
||||
fs.writeFileSync(${JSON.stringify(activityPath)}, "active\\n");
|
||||
fs.writeFileSync(${JSON.stringify(pidPath)}, String(process.pid));
|
||||
// The runner polls for this path; publish only the complete PID by renaming.
|
||||
fs.writeFileSync(${JSON.stringify(`${pidPath}.pending`)}, String(process.pid));
|
||||
fs.renameSync(${JSON.stringify(`${pidPath}.pending`)}, ${JSON.stringify(pidPath)});
|
||||
setInterval(() => fs.appendFileSync(${JSON.stringify(activityPath)}, "active\\n"), 20);
|
||||
`;
|
||||
const runner = launch(
|
||||
|
||||
Reference in new issue
Block a user