Skip to content

Fix flaky AzureDataFactory operator test by mocking time#67427

Merged
jscheffl merged 1 commit into
apache:mainfrom
shubhamraj-git:fix/azure-data-factory-flaky-test-time-mock
May 24, 2026
Merged

Fix flaky AzureDataFactory operator test by mocking time#67427
jscheffl merged 1 commit into
apache:mainfrom
shubhamraj-git:fix/azure-data-factory-flaky-test-time-mock

Conversation

@shubhamraj-git
Copy link
Copy Markdown
Contributor

The test_execute_wait_for_termination[*-timeout] cases were intermittently
failing on CI with assert 3 == 4.

Root cause

The test used real time.sleep(1) with timeout=3, expecting 4 calls to
get_pipeline_run. The loop uses a strict < timeout check, so with exact
1.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 (via itertools.count(0.0, 1.0)) and time.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?
  • Yes — Claude Code (claude-sonnet-4-6)

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 jscheffl merged commit b0921fe into apache:main May 24, 2026
93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants