-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
test(cloudflare): Unflake integration test #20208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,10 +45,20 @@ it('sends child spans on repeated Durable Object calls', async ({ signal }) => { | |
| // Expect 5 transaction envelopes — one per call. | ||
| const runner = createRunner(__dirname).expectN(5, assertDoWorkEnvelope).start(signal); | ||
|
|
||
| // Small delay between requests to allow waitUntil to process in wrangler dev. | ||
| // This is needed because wrangler dev may not guarantee waitUntil completion | ||
| // the same way production Cloudflare does. Without this delay, the last | ||
| // envelope's HTTP request may not complete before the test moves on. | ||
| const delay = () => new Promise(resolve => setTimeout(resolve, 50)); | ||
|
|
||
| await runner.makeRequest('get', '/'); | ||
| await delay(); | ||
| await runner.makeRequest('get', '/'); | ||
| await delay(); | ||
| await runner.makeRequest('get', '/'); | ||
| await delay(); | ||
| await runner.makeRequest('get', '/'); | ||
| await delay(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed-delay sleep may still cause test flakinessLow Severity The test introduces a hardcoded 50ms Triggered by project rule: PR Review Guidelines for Cursor Bot Reviewed by Cursor Bugbot for commit f77c6b1. Configure here. |
||
| await runner.makeRequest('get', '/'); | ||
| await runner.completed(); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,9 @@ export default defineConfig({ | |
| singleThread: true, | ||
| }, | ||
| }, | ||
| sequence: { | ||
| shuffle: true, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maybe I misunderstand but shouldn't shuffle be set to |
||
| }, | ||
| reporters: process.env.DEBUG | ||
| ? ['default', { summary: false }] | ||
| : process.env.GITHUB_ACTIONS | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: can we solve this differently, specifically is there some event that we could await before moving onto the next request instead of adding a timeout? this might already help but I am worried that this will not fully resolve the flakiness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now there is now way, as the runner doesn't provide a way of doing this. Wrangler, as of now, seems to drop
waitUntilruns entirely when another request comes in. For that to work we have to change the way how the runner works, and not register allexpectat once and then call the worker, but rather call the worker and wait for the expect right after. But that would be a bigger part of work AFAICTThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so to understand correctly: We delay here by 50ms so that a kicked off
waitUntiltask finishes before we start a new request? And we do this due to a local wrangler limitation (?)Taking a step back: Why is this test doing 5 request repetitions? I see we always assert on the same payload, without cross-envelope checks, so what do we gain from it? (not saying we shouldn't just that it's not clear).
Given I understand correctly, I'd say the delay is fine (for the lack of better options). But can we make sure this is enough for CI? 50ms seems a bit short but then again, I'm not sure if it's necessary to wait longer. Maybe just deferring to the next tick is already enough?