SameerMesiah97 commented on code in PR #64119:
URL: https://github.com/apache/airflow/pull/64119#discussion_r3109608429
##########
providers/airbyte/tests/unit/airbyte/operators/test_airbyte.py:
##########
@@ -67,6 +68,52 @@ def test_execute(self, mock_wait_for_job,
mock_submit_sync_connection, create_co
job_id=self.job_id, wait_seconds=self.wait_seconds,
timeout=self.timeout
)
+ @pytest.mark.parametrize("status", ["success", "cancelled"])
+ def test_execute_complete_non_error_states(self, status,
create_connection_without_db):
+ conn = Connection(conn_id=self.airbyte_conn_id, conn_type="airbyte",
host="airbyte.com")
+ create_connection_without_db(conn)
+
+ op = AirbyteTriggerSyncOperator(
+ task_id="test_airbyte_op",
+ airbyte_conn_id=self.airbyte_conn_id,
+ connection_id=self.connection_id,
+ wait_seconds=self.wait_seconds,
+ timeout=self.timeout,
+ deferrable=True,
+ )
+
+ event = {
+ "status": status,
+ "message": "succeeded/cancelled",
+ "job_id": self.job_id,
+ }
+
+ result = op.execute_complete(context={}, event=event)
+
+ assert result is None
Review Comment:
If you look at the `execute_complete` method here:
def execute_complete(self, context: Context, event: Any = None) -> None:
"""
Invoke this callback when the trigger fires; return immediately.
Relies on trigger to throw an exception, otherwise it assumes
execution was
successful.
"""
if event["status"] == "error":
self.log.debug("Error occurred with context: %s", context)
raise RuntimeError(event["message"])
self.log.info("%s completed successfully.", self.task_id)
return None
You will see that no error is raised on "cancellation". I suspect that
Co-pilot is assuming that `execute_complete` mirrors `execute`, which is a
hallucination.
--
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]