Fix flaky TMPRL1104 duration-log assertions in test_extstore#1628
Open
DABH wants to merge 2 commits into
Open
Conversation
The worker logs TMPRL1104 with one of three wordings depending on wall-clock task duration: "duration information" (<=5s), "exceeded 5 seconds" (>5s), or "exceeded 10 seconds" (>10s). The tests matched only the "duration information" wording, but the duration is wall-clock time over the whole activation, so on a loaded CI host (tests run under pytest-xdist) a trivial task can occasionally cross 5s and emit the "exceeded" wording instead, failing the re.match. The payload/duration fields under test are attached identically in all three branches, so the assertions now accept any duration-bucket wording.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The TMPRL1104 tests in
tests/worker/test_extstore.pyasserted that each duration log matched only the"Workflow task duration information"wording.Why it's flaky
The worker emits TMPRL1104 with one of three wordings depending on wall-clock task duration (
temporalio/worker/_workflow.py):> 10s→Workflow task exceeded 10 seconds (...)> 5s→Workflow task exceeded 5 seconds (...)Workflow task duration information (...)The measured duration is wall-clock over the whole activation, so on a loaded CI host (the suite runs under
pytest-xdist) even a trivial workflow task can occasionally cross the 5s threshold and emit the "exceeded" wording instead. When that happens there.matchreturnsNoneand the assertion fails withassert None. Thelen(records) == Ncheck still passes because one record is still emitted per WFT, and the payload/duration fields the tests actually verify are attached identically regardless of which bucket fired.Observed on a
macos-armjob; unrelated to the PR it surfaced on.Fix
Accept any duration-bucket wording via a single shared compiled pattern, which also collapses the 7 duplicated
re.matchblocks.