uranusjr commented on code in PR #51295:
URL: https://github.com/apache/airflow/pull/51295#discussion_r2122440548
##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -705,6 +705,41 @@ def test_ti_update_state_to_success_with_asset_events(
assert event[0].asset == AssetModel(name="my-task",
uri="s3://bucket/my-task", extra={})
assert event[0].extra == expected_extra
+ def test_ti_update_state_to_failed_with_inactive_asset(self, client,
session, create_task_instance):
+ # inactive
+ asset = AssetModel(
+ id=1,
+ name="my-task-2",
+ uri="s3://bucket/my-task",
+ group="asset",
+ extra={},
+ )
+ session.add(asset)
+
+ ti = create_task_instance(
+ task_id="test_ti_update_state_to_success_with_asset_events",
+ start_date=DEFAULT_START_DATE,
+ state=State.RUNNING,
+ )
+ session.commit()
+
+ response = client.patch(
+ f"/execution/task-instances/{ti.id}/state",
+ json={
+ "state": "success",
+ "end_date": DEFAULT_END_DATE.isoformat(),
+ "task_outlets": [{"name": "my-task-2", "uri":
"s3://bucket/my-task", "type": "Asset"}],
+ "outlet_events": [],
+ },
+ )
+
+ assert response.status_code == 204
+ assert response.text == ""
Review Comment:
204 is No Content so clients will likely just ignore the response content
anyway. No need to do this check. (Although I guess it’s not a problem to check
it either.)
--
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]