Skip to content

Commit de1d65c

Browse files
committed
fmt
1 parent ce584d7 commit de1d65c

File tree

1 file changed

+46
-40
lines changed

1 file changed

+46
-40
lines changed

js/tests/systemd.test.ts

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,50 +18,56 @@ async function waitForHealth(sandbox: any, maxRetries = 10, intervalMs = 100) {
1818
return false
1919
}
2020

21-
sandboxTest.skipIf(isDebug)('restart after jupyter kill', async ({ sandbox }) => {
22-
// Verify health is up initially
23-
const initialHealth = await waitForHealth(sandbox)
24-
expect(initialHealth).toBe(true)
21+
sandboxTest.skipIf(isDebug)(
22+
'restart after jupyter kill',
23+
async ({ sandbox }) => {
24+
// Verify health is up initially
25+
const initialHealth = await waitForHealth(sandbox)
26+
expect(initialHealth).toBe(true)
2527

26-
// Kill the jupyter process as root
27-
// The command handle may get killed too (since killing jupyter cascades to code-interpreter),
28-
// so we catch the error.
29-
try {
30-
await sandbox.commands.run("kill -9 $(pgrep -f 'jupyter server')", {
31-
user: 'root',
32-
})
33-
} catch {
34-
// Expected — the kill cascade may terminate the command handle
35-
}
28+
// Kill the jupyter process as root
29+
// The command handle may get killed too (since killing jupyter cascades to code-interpreter),
30+
// so we catch the error.
31+
try {
32+
await sandbox.commands.run("kill -9 $(pgrep -f 'jupyter server')", {
33+
user: 'root',
34+
})
35+
} catch {
36+
// Expected — the kill cascade may terminate the command handle
37+
}
3638

37-
// Wait for systemd to restart both services
38-
const recovered = await waitForHealth(sandbox, 60, 500)
39-
expect(recovered).toBe(true)
39+
// Wait for systemd to restart both services
40+
const recovered = await waitForHealth(sandbox, 60, 500)
41+
expect(recovered).toBe(true)
4042

41-
// Verify code execution works after recovery
42-
const result = await sandbox.runCode('x = 1; x')
43-
expect(result.text).toEqual('1')
44-
})
43+
// Verify code execution works after recovery
44+
const result = await sandbox.runCode('x = 1; x')
45+
expect(result.text).toEqual('1')
46+
}
47+
)
4548

46-
sandboxTest.skipIf(isDebug)('restart after code-interpreter kill', async ({ sandbox }) => {
47-
// Verify health is up initially
48-
const initialHealth = await waitForHealth(sandbox)
49-
expect(initialHealth).toBe(true)
49+
sandboxTest.skipIf(isDebug)(
50+
'restart after code-interpreter kill',
51+
async ({ sandbox }) => {
52+
// Verify health is up initially
53+
const initialHealth = await waitForHealth(sandbox)
54+
expect(initialHealth).toBe(true)
5055

51-
// Kill the code-interpreter process as root
52-
try {
53-
await sandbox.commands.run("kill -9 $(pgrep -f 'uvicorn main:app')", {
54-
user: 'root',
55-
})
56-
} catch {
57-
// Expected — killing code-interpreter may terminate the command handle
58-
}
56+
// Kill the code-interpreter process as root
57+
try {
58+
await sandbox.commands.run("kill -9 $(pgrep -f 'uvicorn main:app')", {
59+
user: 'root',
60+
})
61+
} catch {
62+
// Expected — killing code-interpreter may terminate the command handle
63+
}
5964

60-
// Wait for systemd to restart it and health to come back
61-
const recovered = await waitForHealth(sandbox, 60, 500)
62-
expect(recovered).toBe(true)
65+
// Wait for systemd to restart it and health to come back
66+
const recovered = await waitForHealth(sandbox, 60, 500)
67+
expect(recovered).toBe(true)
6368

64-
// Verify code execution works after recovery
65-
const result = await sandbox.runCode('x = 1; x')
66-
expect(result.text).toEqual('1')
67-
})
69+
// Verify code execution works after recovery
70+
const result = await sandbox.runCode('x = 1; x')
71+
expect(result.text).toEqual('1')
72+
}
73+
)

0 commit comments

Comments
 (0)