aurangzaib048 commented on code in PR #64770:
URL: https://github.com/apache/airflow/pull/64770#discussion_r3067057834
##########
providers/amazon/tests/unit/amazon/aws/operators/test_emr_containers.py:
##########
@@ -162,6 +162,19 @@ def test_operator_defer_with_timeout(self,
mock_submit_job, mock_check_query_sta
assert trigger.waiter_delay == self.emr_container.poll_interval
assert trigger.attempts == self.emr_container.max_polling_attempts
+ @mock.patch.object(EmrContainerHook, "stop_query")
+ def test_execute_complete_cancels_job_on_failure(self, mock_stop_query):
+ self.emr_container.job_id = "test_job_id"
+ event = {"status": "error", "message": "Job timed out", "job_id":
"test_job_id"}
+ with pytest.raises(AirflowException):
+ self.emr_container.execute_complete(context=None, event=event)
+ mock_stop_query.assert_called_once_with("test_job_id")
+
Review Comment:
Added `test_execute_complete_raises_original_error_when_cancel_fails` —
mocks `stop_query` to raise and asserts the original `AirflowException` is
still propagated.
--
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]