ephraimbuddy commented on code in PR #76016:
URL: https://github.com/apache/airflow/pull/76016#discussion_r4421818530


##########
airflow-core/tests/unit/cli/commands/test_triggerer_command.py:
##########
@@ -84,6 +84,20 @@ def test_trigger_run_serve_logs(self, mock_process, 
mock_run_job, mock_trigger_j
             execute_callable=mock_trigger_job_runner.return_value._execute,
         )
 
+    @mock.patch("airflow.cli.commands.triggerer_command.gc")
+    @mock.patch("airflow.cli.commands.triggerer_command.Process")
+    def test_serve_logs_freezes_gc_around_fork(self, mock_process, mock_gc):
+        """serve_logs must be forked with the GC frozen so a later GC can't 
split COW-shared pages."""
+        manager = mock.Mock()
+        manager.attach_mock(mock_gc.freeze, "freeze")
+        manager.attach_mock(mock_gc.unfreeze, "unfreeze")
+        manager.attach_mock(mock_process.return_value.start, "start")
+
+        with triggerer_command._serve_logs(skip_serve_logs=False):
+            pass

Review Comment:
   This pins unfreeze after start, so it needs to change with the above. Please 
add a non-fork case, and use autospec=True on the patches.



-- 
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