Fix flaky KubernetesPodOperator log-timestamp test - #69563
Merged
Conversation
Dev-iL
requested review from
hussein-awala,
jedcunningham and
jscheffl
as code owners
July 7, 2026 15:56
shahar1
approved these changes
Jul 7, 2026
The parametrize data for test_fetch_container_logs_before_current_sec_various_logs built each log line's timestamp and the test's `now` value from separate pendulum.now() calls at collection time. When those calls straddled a second boundary, the "timestamp equal to the current second" cases (3 and 6) would intermittently fail because the values were no longer equal to the second. Build timestamps as offsets from a single fixed reference instant instead.
The msk extra was added to providers/apache/kafka/pyproject.toml without regenerating docs/index.rst, so the extras table was missing the corresponding row. CI's doc-sync check flags this drift on every PR touching this branch, regardless of relevance, so fix it here to unblock.
Dev-iL
force-pushed
the
2607/deflake_podlog
branch
from
July 8, 2026 05:42
cd9a092 to
8439ba2
Compare
1 task
amoghrajesh
approved these changes
Jul 8, 2026
jason810496
approved these changes
Jul 8, 2026
Member
|
We can merge if the provider test pass, the remaining CI failure on current run was addressed in #69583. |
Lee-W
approved these changes
Jul 8, 2026
Contributor
|
Thanks Dev-iL for fixing it! |
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.
Fixes a flaky unit test in
TestAsyncPodManager::test_fetch_container_logs_before_current_sec_various_logs.The parametrize data built each log line's timestamp and the test's
nowvalue from separatependulum.now()calls made at collection time. When those calls happened to straddle a second boundary, the "timestamp equal to the current second" cases (3 and 6) would intermittently fail, because the values were no longer equal once truncated to the second — even though the test assumed they always would be.This surfaced as an intermittent CI failure:
The fix removes the wall-clock dependency: each parametrize case now specifies log-line timestamps as second offsets (or
Nonefor a continuation line with no timestamp) relative to a single fixed reference instant (pendulum.datetime(2024, 1, 1, 12, 0, 0)) that the test body builds and mockspendulum.now()to return. This guarantees the "equal to now" cases are always exactly equal to the second, regardless of how fast or slow the test runs.Verified the previously-flaky test 20x in a row locally with no failures, and confirmed the failure reproduces identically on
mainwithout this change (i.e., unrelated to any in-flight work).Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Sonnet 5) following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.