-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Try fix flakey public processor test (#11348)
Tries fixing a flakey test from the public processor (example failed run [here](https://github.com/AztecProtocol/aztec-packages/actions/runs/12864214502/job/35862843875#step:3:1373)). This PR: - Doubles all times in the flakey unit test, so small variations in CI affect less - Adds tests for the public processor and catches the edge case of timeout being accidentally zero (and thus ignored) - Removes operations inbetween the timeout being computed and the action being kicked off
- Loading branch information
1 parent
bb96e7c
commit 8de55d4
Showing
4 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { sleep } from '../sleep/index.js'; | ||
import { executeTimeout } from './timeout.js'; | ||
|
||
describe('timeout', () => { | ||
it('execs within timeout', async () => { | ||
await expect(executeTimeout(() => sleep(200).then(() => 'ok'), 300)).resolves.toEqual('ok'); | ||
}); | ||
|
||
it('rejects with custom error on timeout', async () => { | ||
await expect(executeTimeout(() => sleep(500), 200, 'Timed out!')).rejects.toThrow('Timed out!'); | ||
}); | ||
|
||
it('rejects if timeout is zero', async () => { | ||
await expect(executeTimeout(() => sleep(500), 0, 'Timed out!')).rejects.toThrow('Timed out!'); | ||
}); | ||
|
||
it('rejects if timeout is negative', async () => { | ||
await expect(executeTimeout(() => sleep(500), -100, 'Timed out!')).rejects.toThrow('Timed out!'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters