Skip to content

Commit cfaa457

Browse files
Lms24claude
andauthored
test(cloudflare): De-flake Workflow auto-instrumentation test (#23829)
The scenario emits two transactions (`step-one` and `GET /workflow/trigger`) from separate executions, but the test expected one envelope in ordered mode — so it asserted against whichever won the race. Now expects both, unordered. - Matches every other `vite-autoinstrument` multi-transaction suite. - Also asserts the request transaction, previously unchecked. - Reproduced the CI failure locally before and after. Fixes #23242 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent a3de56d commit cfaa457

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • dev-packages/cloudflare-integration-tests/suites/vite-autoinstrument/workflow

‎dev-packages/cloudflare-integration-tests/suites/vite-autoinstrument/workflow/test.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import { createRunner } from '../../../runner';
44

55
// The worker is built by the Sentry Vite plugin (auto-instrumentation on). The
66
// runner detects `vite.config.mts`, runs `vite build`, and serves the generated
7-
// output — so a workflow-step transaction only arrives if the build-time
8-
// transform wrapped `MyWorkflow` with `instrumentWorkflowWithSentry`.
7+
// output — so these transactions only arrive if the build-time transform wrapped
8+
// `MyWorkflow` with `instrumentWorkflowWithSentry` and the default export with
9+
// `withSentry`.
10+
//
11+
// The workflow step and the triggering request are separate executions whose
12+
// envelopes race, so both are expected `unordered`.
913
it('auto-instruments a Workflow class', async ({ signal }) => {
1014
const runner = createRunner(__dirname)
1115
.expect(envelope => {
@@ -14,6 +18,13 @@ it('auto-instruments a Workflow class', async ({ signal }) => {
1418
expect(transactionEvent.contexts?.trace?.op).toBe('function');
1519
expect(transactionEvent.contexts?.trace?.origin).toBe('auto.faas.cloudflare.workflow');
1620
})
21+
.expect(envelope => {
22+
const transactionEvent = envelope[1]?.[0]?.[1] as TransactionEvent;
23+
expect(transactionEvent.transaction).toBe('GET /workflow/trigger');
24+
expect(transactionEvent.contexts?.trace?.op).toBe('http.server');
25+
expect(transactionEvent.contexts?.trace?.origin).toBe('auto.http.cloudflare');
26+
})
27+
.unordered()
1728
.start(signal);
1829

1930
await runner.makeRequest('get', '/workflow/trigger');

0 commit comments

Comments
 (0)