fix(test): run the server suite on a private tmux server
Several suites start real `agenthub-lane-<id>` tmux sessions and then kill or reset them, with lane ids from their own throwaway database. On the user's default tmux server those names collide with the dashboard's real lane panes, so a test run — including the one the pre-commit hook runs on every commit — killed whichever live session shared an id, the pane the commit was made from included. `npm run test:server` now goes through scripts/test-server.js, which drops TMUX, points TMUX_TMPDIR at a fresh directory and kills that server after. Also fixes the ERUNTIMEOUT test's tmux mock, which had the wrong (async, cmd+args) signature and only passed by accident.
This commit is contained in:
@@ -848,17 +848,12 @@ describe("destructive lane lifecycle actions", () => {
|
||||
const runId = started.body.lane.run_id;
|
||||
|
||||
// Mock tmux so has-session always returns 0 (session exists), simulating a stuck session
|
||||
tmux.__setExecImpl(async (cmd, args) => {
|
||||
if (cmd === "tmux" && args[0] === "has-session" && args[1] === "-t" && args[2] === runId) {
|
||||
return { code: 0, stdout: "", stderr: "" };
|
||||
}
|
||||
if (cmd === "tmux" && args[0] === "list-sessions") {
|
||||
return { code: 0, stdout: "", stderr: "" };
|
||||
}
|
||||
if (cmd === "tmux" && args[0] === "kill-session" && args[1] === "-t" && args[2] === runId) {
|
||||
return { code: 0, stdout: "", stderr: "" };
|
||||
}
|
||||
return { code: 1, stdout: "", stderr: "" };
|
||||
// Same shape as tmux.js's own exec: sync, argv only, throws on failure.
|
||||
tmux.__setExecImpl((args) => {
|
||||
if (args[0] === "has-session" && args[2] === runId) return "";
|
||||
if (args[0] === "list-sessions") return `${runId}\n`;
|
||||
if (args[0] === "kill-session" && args[2] === runId) return "";
|
||||
throw Object.assign(new Error("mocked tmux failure"), { status: 1 });
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user