This is an automated email from the ASF dual-hosted git repository. rusackas pushed a commit to branch fix/execution-claim-stale-retry-race in repository https://gitbox.apache.org/repos/asf/superset.git
commit e216123f7737b42363c43b8b20c940e592bd5266 Author: Evan Rusackas <[email protected]> AuthorDate: Wed Sep 23 15:37:22 2026 -0700 fix(reports): freeze time in the stale-retry boundary test to stop a CI race test_stale_retry_recovers_at_max_delay asserts on either side of the 3600s stale-retry threshold, but claim_execution compares against a fresh datetime.utcnow() internally rather than the `now` passed into it. Under load, any real delay between the test's setup and that internal check pushes the effective age across the boundary and flips the assertion — this is what flaked as test_stale_retry_recovers_at_max_delay[Alert-sqlite-3599-False] on master's Python-Unit CI. Freeze time for the test instead of relying on the real clock staying still. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5 <[email protected]> --- tests/unit_tests/commands/report/execution_claim_test.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/commands/report/execution_claim_test.py b/tests/unit_tests/commands/report/execution_claim_test.py index 7baadc9314a..a05b6741a2d 100644 --- a/tests/unit_tests/commands/report/execution_claim_test.py +++ b/tests/unit_tests/commands/report/execution_claim_test.py @@ -27,6 +27,7 @@ from uuid import uuid4 import pytest import sqlalchemy as sa +from freezegun import freeze_time from pytest_mock import MockerFixture from sqlalchemy.orm import sessionmaker @@ -391,7 +392,13 @@ def test_stale_retry_recovers_at_max_delay( ) -> None: """Admission must not add the execution budget to the retry recovery delay.""" now = utc_now().replace(microsecond=0) - with sessions() as session: + # Freeze time: the admission check below compares against a fresh + # datetime.utcnow() (not the `now` passed to claim_execution), and this + # test sits exactly on the 3600s boundary. Without freezing, any real + # delay between the setup below and that internal check (e.g. under a + # loaded CI run) shifts the effective age across the boundary and flips + # the assertion. + with freeze_time(now), sessions() as session: schedule = session.query(ReportSchedule).one() schedule.last_state = ReportState.RETRYING schedule.execution_owner = "owner"
