kaxil commented on code in PR #76904:
URL: https://github.com/apache/airflow/pull/76904#discussion_r4539719290


##########
providers/databricks/tests/unit/databricks/operators/test_databricks.py:
##########
@@ -2541,6 +2541,21 @@ def 
test_execute_complete_repair_includes_named_job_parameters(self, mock_handle
         assert repair_json_passed["job_parameters"] == {"k": "v"}
         assert mock_handle_exec.called
 
+    
@mock.patch("airflow.providers.databricks.operators.databricks.DatabricksHook")
+    def test_sync_repair_that_succeeds_does_not_fail_the_task(self, 
db_mock_class):
+        op = DatabricksRunNowOperator(durable=False, task_id=TASK_ID, 
job_id=JOB_ID, repair_run=True)
+        db_mock = db_mock_class.return_value
+        db_mock.run_now.return_value = RUN_ID
+        db_mock.get_run.side_effect = [
+            make_run_with_state_mock("TERMINATED", "FAILED").return_value,
+            make_run_with_state_mock("TERMINATED", "SUCCESS").return_value,
+        ]
+        db_mock.get_latest_repair_id.return_value = None
+
+        op.execute(None)
+
+        db_mock.repair_run.assert_called_once()

Review Comment:
   Could this also assert `db_mock.get_run.call_count == 2`? As written it 
still passes if the inner `_handle_databricks_operator_execution` call is 
dropped and the function just returns after `repair_run`, which would mark the 
task successful without ever polling the repaired run.



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