@@ -3,26 +3,23 @@ import { sandboxTest } from './setup'
33
44// Regression test for issue #213: asyncio.Lock not released on client disconnect.
55// Uses its own context to avoid blocking other parallel tests with the sleep.
6- sandboxTest (
7- 'execution after timeout is not blocked' ,
8- async ( { sandbox } ) => {
9- const context = await sandbox . createCodeContext ( )
6+ sandboxTest ( 'execution after timeout is not blocked' , async ( { sandbox } ) => {
7+ const context = await sandbox . createCodeContext ( )
108
11- // sleep(5) with 2s timeout: client disconnects at 2s, kernel finishes at 5s.
12- await expect (
13- sandbox . runCode ( 'import time; time.sleep(5)' , {
14- context,
15- timeoutMs : 2_000 ,
16- } )
17- ) . rejects . toThrow ( )
18-
19- // With the fix (lock released after send), this sends immediately and
20- // succeeds once the kernel finishes the sleep. Without the fix, this
21- // blocks on the server lock indefinitely.
22- const result = await sandbox . runCode ( 'x = 1; x' , {
9+ // sleep(5) with 2s timeout: client disconnects at 2s, kernel finishes at 5s.
10+ await expect (
11+ sandbox . runCode ( 'import time; time.sleep(5)' , {
2312 context,
24- timeoutMs : 15_000 ,
13+ timeoutMs : 2_000 ,
2514 } )
26- expect ( result . text ) . toEqual ( '1' )
27- } ,
28- )
15+ ) . rejects . toThrow ( )
16+
17+ // With the fix (lock released after send), this sends immediately and
18+ // succeeds once the kernel finishes the sleep. Without the fix, this
19+ // blocks on the server lock indefinitely.
20+ const result = await sandbox . runCode ( 'x = 1; x' , {
21+ context,
22+ timeoutMs : 15_000 ,
23+ } )
24+ expect ( result . text ) . toEqual ( '1' )
25+ } )
0 commit comments