Skip to content

Commit 96796e9

Browse files
committed
test(sandbox): make deadline assertions timing-safe
1 parent e3f33d1 commit 96796e9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/sim/lib/execution/remote-sandbox/conformance.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,9 @@ describe('custom dependency sets', () => {
12931293
})
12941294

12951295
if (provider === 'e2b') {
1296-
expect(mockE2BCreate.mock.calls[0][1].timeoutMs).toBe(46_000)
1296+
const sandboxTimeoutMs = mockE2BCreate.mock.calls[0][1].timeoutMs
1297+
expect(sandboxTimeoutMs).toBeGreaterThan(45_000)
1298+
expect(sandboxTimeoutMs).toBeLessThanOrEqual(46_000)
12971299
const commandTimeoutMs = mockE2BCommandsRun.mock.calls.at(-1)?.[1].timeoutMs
12981300
expect(commandTimeoutMs).toBeGreaterThan(45_000)
12991301
expect(commandTimeoutMs).toBeLessThanOrEqual(46_000)
@@ -1318,7 +1320,9 @@ describe('custom dependency sets', () => {
13181320
})
13191321

13201322
if (provider === 'e2b') {
1321-
expect(mockE2BCommandsRun.mock.calls.at(-1)?.[1].timeoutMs).toBe(1000)
1323+
const commandTimeoutMs = mockE2BCommandsRun.mock.calls.at(-1)?.[1].timeoutMs
1324+
expect(commandTimeoutMs).toBeGreaterThan(0)
1325+
expect(commandTimeoutMs).toBeLessThanOrEqual(1000)
13221326
} else {
13231327
expect(mockExecuteSessionCommand.mock.calls.at(-1)?.[2]).toBe(1)
13241328
}

0 commit comments

Comments
 (0)