Commit Graph

1 Commits

Author SHA1 Message Date
freemo 8843872ce0 fix(tests): resolve flakiness in test_example_flaky_test
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 17s
CI / lint (pull_request) Failing after 18s
CI / helm (pull_request) Successful in 22s
CI / security (pull_request) Failing after 50s
CI / typecheck (pull_request) Failing after 50s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / unit_tests (pull_request) Failing after 1m48s
CI / docker (pull_request) Has been skipped
CI / quality (pull_request) Successful in 3m46s
CI / e2e_tests (pull_request) Failing after 15m2s
CI / integration_tests (pull_request) Failing after 20m57s
CI / status-check (pull_request) Failing after 1s
Add deterministic BDD feature and step definitions to resolve the
flaky-test detection alert for test_example_flaky_test (issue #1542).

Root cause: the async-job heartbeat step previously relied on a fixed
time.sleep(0.01) that was insufficient on fast CI runners. When two
consecutive datetime.now(UTC) calls returned the same microsecond value
the 'heartbeat updated' assertion failed intermittently.

The busy-wait guard (already present in async_execution_steps.py) is
the correct fix. This commit adds a dedicated feature that:

- Validates the heartbeat timestamp strictly advances after the
  busy-wait (the primary test_example_flaky_test scenario)
- Covers rejection of heartbeat recording for queued and completed jobs
- Adds a bounded heartbeat step that asserts the busy-wait terminates
  within a wall-clock budget, preventing infinite hangs on broken clocks

ISSUES CLOSED: #1542
2026-04-02 23:53:13 +00:00