Fix flaky AzureDataFactory operator test by mocking time#67427
Merged
jscheffl merged 1 commit intoMay 24, 2026
Merged
Conversation
The test_execute_wait_for_termination[*-timeout] cases relied on real wall-clock time.sleep(1) calls with timeout=3, expecting exactly 4 get_pipeline_run calls. On loaded CI machines where time.sleep(1) overshoots by >0.5s, only 2 loop iterations complete before the 3-second timeout fires, giving 3 calls instead of 4. Fix by patching time.monotonic (via itertools.count) and time.sleep in the hook module, making the iteration count deterministic regardless of system load.
jscheffl
approved these changes
May 24, 2026
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.
The
test_execute_wait_for_termination[*-timeout]cases were intermittentlyfailing on CI with
assert 3 == 4.Root cause
The test used real
time.sleep(1)withtimeout=3, expecting 4 calls toget_pipeline_run. The loop uses a strict<timeout check, so with exact1.0s sleeps you get 5 calls, and on a loaded CI runner where sleeps overshoot
by >0.5s you get 3 — neither is the expected 4.
Fix
Patch
time.monotonic(viaitertools.count(0.0, 1.0)) andtime.sleep(no-op) in the hook module for the timeout cases. The deterministic sequence
0→1→2→3→4 fires the timeout check after exactly 3 iterations regardless
of system load, giving 4 total calls.
Was generative AI tooling used to co-author this PR?