[workflows-shared] Fix test flakiness on Windows CI#13600
[workflows-shared] Fix test flakiness on Windows CI#13600petebacondarwin merged 3 commits intomainfrom
Conversation
|
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
|
UnknownError: ProviderInitError |
|
@petebacondarwin Bonk workflow failed. Check the logs for details. View workflow run · To retry, trigger Bonk again. |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
The devin's comments about filter returning always truthy values seem valid to me 🤔
90d0d73 to
d80d336
Compare
52b2515 to
65241fa
Compare
The workflows-shared vitest config was not extending the monorepo-wide
vitest.shared.ts, so tests ran with vitest's default 5s test timeout
(vs the shared 50s) and zero retries. Combined with tight vi.waitUntil
polling timeouts (500-1000ms), this caused consistent failures on slow
Windows CI runners.
- Merge vitest.shared.ts into workflows-shared vitest config (adds
testTimeout: 50s, retry: 2, restoreMocks: true)
- Raise waitUntilLogEvent helper default timeout from 1s to 5s
- Fix bare-number vi.waitUntil(cb, 500) calls to use { timeout: 5000 }
- Bump all vi.waitUntil polling timeouts from 500-3000ms to 5000ms
(preserving deliberate step.waitForEvent timeouts that test workflow
timeout semantics)
The 'should increment step count for steps with the same name' test runs 3 sequential step.do calls, which needs more headroom than single-step tests on slow Windows CI runners. Bump its vi.waitUntil timeout from 5s to 10s.
Two waitForEvent tests used .filter() (returns Array, always truthy)
inside vi.waitUntil callbacks instead of .some() (returns boolean).
This made the waits resolve immediately on the first poll without
actually checking whether the expected events had been logged.
- Replace .filter() with .some() so vi.waitUntil actually polls
- Use === instead of == for strict equality
- Add { expect } from test context and real assertions verifying
WAIT_START and WORKFLOW_SUCCESS events are present in the logs
- Remove the eslint-disable jest/expect-expect comments since the
tests now contain proper assertions
65241fa to
004efb4
Compare
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Fixes consistent
@cloudflare/workflows-sharedtest failures on Windows CI runners (e.g. https://github.com/cloudflare/workers-sdk/actions/runs/24634528457/job/72027500951).Root cause: The
workflows-sharedvitest config was not extending the monorepo-widevitest.shared.ts. This meant tests ran with vitest's default 5s test timeout (vs the shared 50s used everywhere else) and zero retries. Combined with tightvi.waitUntilpolling timeouts (500–1000ms), the first tests in each file consistently timed out on slow Windows runners due to cold workerd/DO startup costs.Six tests across 3 files were failing:
binding.test.ts: 2 failures (test timeout 5000ms, waitUntil timeout 1000ms)context.test.ts: 2 failures (test timeout 5000ms, waitUntil timeout 1000ms)engine.test.ts: 2 failures (test timeout 5000ms, waitUntil timeout 1000ms)Changes:
vitest.shared.tsintoworkflows-shared/vitest.config.mts— picks uptestTimeout: 50_000,retry: 2,restoreMocks: truewaitUntilLogEventhelper default from 1000ms → 5000ms (affects all 13 call sites in binding.test.ts)vi.waitUntil(cb, 500)calls in engine.test.ts to proper{ timeout: 5000 }formatvi.waitUntilpolling timeouts from 500–3000ms → 5000ms across all 3 test filesDeliberately not changed:
step.waitForEventtimeouts,step.sleepdurations, andretries.delayvalues — those test real workflow timeout semantics.