Skip to content

Commit 1b6796c

Browse files
committed
Make two tests hold on Linux
Ubuntu's /bin/sh stays as the parent of `sh -c sleep`, and a reset during the connect reports [::1]'s refusal where localhost has both loopbacks.
1 parent f9d9261 commit 1b6796c

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎packages/stackctl/src/dev-reverse-proxy.spec.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,8 +1945,11 @@ describe('infra services', () => {
19451945
const json = await request(proxy.port, `s3.${ROOT}`, { headers: { accept: 'application/json' } }); // oxfmt-ignore
19461946
expect(json.status).toBe(502);
19471947
expect(JSON.parse(json.body)).toMatchObject({ infraService: 'store', port });
1948-
// A reset that lands while the request is still being written surfaces as EPIPE instead.
1949-
expect(['ECONNRESET', 'EPIPE']).toContain(JSON.parse(json.body).code);
1948+
// A reset that lands while the request is still being written surfaces as EPIPE instead. One
1949+
// that lands while the connection is still being made fails that attempt, and where
1950+
// `localhost` is `[::1]` too (Linux), the dial reports the first address's error: `[::1]`
1951+
// refused, as nothing listens there.
1952+
expect(['ECONNRESET', 'EPIPE', 'ECONNREFUSED']).toContain(JSON.parse(json.body).code);
19501953
});
19511954

19521955
test("never consults a package's status, even one sharing the service's name", async () => {

‎packages/stackctl/src/session-takeover.spec.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ describe.runIf(unix)('the orphan sweep', () => {
301301

302302
test("kills that child once the recording session's pid is dead", async () => {
303303
const dir = tmpDir();
304-
const child = detached('sleep 30', dir);
304+
// `sleep` itself, not through `sh -c`: Debian's and Ubuntu's `/bin/sh` (dash) stays as its
305+
// parent, which would make the group two processes there and one on macOS.
306+
const child = spawn('sleep', ['30'], { cwd: dir, detached: true, stdio: 'ignore' });
307+
children.push(child);
305308
const messages: string[] = [];
306309
const record = { port: 1, pid: reapedPid(), children: [{ pid: child.pid!, cwd: dir }] };
307310
const exited = once(child, 'exit');

0 commit comments

Comments
 (0)