jx2lee commented on code in PR #44986:
URL: https://github.com/apache/airflow/pull/44986#discussion_r1941065411


##########
tests/api_fastapi/execution_api/routes/test_task_instances.py:
##########
@@ -716,6 +716,81 @@ def test_ti_runtime_checks_failure(self, client, session, 
create_task_instance):
 
         session.expire_all()
 
+    def test_ti_update_state_to_fail_with_asset_profile_extra(self, client, 
session, create_task_instance):
+        clear_db_assets()
+        clear_db_runs()
+
+        asset = AssetModel(
+            id=1,
+            name="s3://bucket/my-task",
+            uri="s3://bucket/my-task",
+            group="asset",
+            extra={},
+        )
+        asset_active = AssetActive.for_asset(asset)
+        session.add_all([asset, asset_active])
+
+        ti = create_task_instance(
+            task_id="test_ti_update_state_to_fail_with_extra",
+            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": "s3://bucket/my-task",
+                        "uri": "s3://bucket/my-task",
+                        "asset_type": "Asset",
+                        "foo": "bar",
+                    }
+                ],
+                "outlet_events": {
+                    "key": {"name": "s3://bucket/my-task", "uri": 
"s3://bucket/my-task"},
+                    "extra": {},
+                    "asset_alias_events": [],
+                },
+            },
+        )
+
+        assert response.status_code == 422
+        assert response.json()["detail"][0]["msg"] == "Extra inputs are not 
permitted"
+        session.expire_all()

Review Comment:
   In other related tests, this line is used. I felt this line was necessary. 
(clean after session.commit)
   Is this unnecessary?



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