Skip to content

Commit 28278de

Browse files
authored
Fix flaky timeout test by using relative start_time calculation (#54641)
1 parent c9e30de commit 28278de

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

airflow-core/tests/unit/dag_processing/test_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,11 @@ def test_scan_stale_dags(self, testing_dag_bundle):
518518
# SerializedDagModel gives history about Dags
519519
assert serialized_dag_count == 1
520520

521-
@time_machine.travel(datetime(2000, 1, 1, 0, 0, 0), tick=False)
522521
def test_kill_timed_out_processors_kill(self):
523522
manager = DagFileProcessorManager(max_runs=1, processor_timeout=5)
524-
processor, _ = self.mock_processor(start_time=16000)
523+
# Set start_time to ensure timeout occurs: start_time = current_time - (timeout + 1) = always (timeout + 1) seconds
524+
start_time = time.monotonic() - manager.processor_timeout - 1
525+
processor, _ = self.mock_processor(start_time=start_time)
525526
manager._processors = {
526527
DagFileInfo(
527528
bundle_name="testing", rel_path=Path("abc.txt"), bundle_path=TEST_DAGS_FOLDER

0 commit comments

Comments
 (0)