Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dev-packages/cloudflare-integration-tests/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ export function createRunner(...paths: string[]) {
`SENTRY_DSN:http://public@localhost:${mockServerPort}/1337`,
'--var',
`SERVER_URL:${serverUrl}`,
'--port',
'0',
'--inspector-port',
'0',
],
{ stdio, signal },
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Copy link
Copy Markdown
Member

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


await runner.makeRequest('get', '/');
await delay();
await runner.makeRequest('get', '/');
await delay();
await runner.makeRequest('get', '/');
await delay();
await runner.makeRequest('get', '/');
await delay();
await runner.makeRequest('get', '/');
await runner.completed();
});
3 changes: 3 additions & 0 deletions dev-packages/cloudflare-integration-tests/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export default defineConfig({
singleThread: true,
},
},
sequence: {
shuffle: true,
},
reporters: process.env.DEBUG
? ['default', { summary: false }]
: process.env.GITHUB_ACTIONS
Expand Down
Loading