Fix Flaky TestDonTimeProvider_GetDONTime_requestTimeout - #23554
Conversation
|
👋 kalverra, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
✅ No conflicts with other open PRs targeting |
|
I see you updated files related to
|
|
There was a problem hiding this comment.
Pull request overview
Risk Rating: LOW
This PR addresses a flaky workflow engine test (TestDonTimeProvider_GetDONTime_requestTimeout) by making DON time request timeouts deterministic in tests via an injected clockwork.Clock, while preserving existing runtime behavior by defaulting to a real clock.
Changes:
- Injected a
clockwork.ClockintoDonTimeProviderand used it to create the request timeout timer. - Updated the flaky timeout test to use a
clockwork.FakeClockand drive time deterministically. - Updated workflow engine call sites to pass the engine’s configured clock into
NewDonTimeProvider.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| core/services/workflows/v2/time_provider.go | Adds an injectable clock to DonTimeProvider and uses it for the request timeout timer. |
| core/services/workflows/v2/time_provider_test.go | Reworks the timeout test to use a fake clock and avoid real-time sleeps/elapsed assertions. |
| core/services/workflows/v2/engine.go | Passes e.cfg.Clock into NewDonTimeProvider at all call sites. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.




Fixes a flake in
TestDonTimeProvider_GetDONTime_requestTimeoutwhere an overloaded CI runner would hit issues with timing. To do so, we inject aclockwork.Clockfor testing.