Andrushika commented on issue #46432:
URL: https://github.com/apache/airflow/issues/46432#issuecomment-4990563861

   I think this flaky test has been solved by #46443 and #46604, maybe we can 
close this issue now.
   
   I traced the test history and I think the flakiness came from two places, 
the old version of the test looked like this:
   
   ```python
   # Mock might_contain_dag to mimic deleting the python file from the zip
   with mock.patch("airflow.dag_processing.manager.might_contain_dag", 
return_value=False):
       with configure_testing_dag_bundle(TEST_DAGS_FOLDER):
           manager = DagFileProcessorManager(max_runs=1)
           manager.run()
   ...
   assert not dag.get_is_active()
   ```
   
   1. The test mocked `manager.might_contain_dag` to simulate deletion, but the 
zip was still present in the shared Dag folder and could still be parsed during 
`manager.run()`. When the manager collected that parse result, 
`DAG.bulk_write_to_db()` set `DagModel.is_active` back to `True`, making the 
final assertion timing-dependent.
   2. The bundle pointed at the shared `TEST_DAGS_FOLDER`, so the manager had 
to parse all 41 files there. This made the parsing order and timing different 
on every run.
   
   The current test avoids this conflict: it copies the zip into an isolated 
temporary bundle, parses it, actually deletes it with os.remove(), and runs the 
manager again. Both paths now observe that the zip is gone.
   Can we close this issue now?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to