dhkim1920 commented on code in PR #73783:
URL: https://github.com/apache/airflow/pull/73783#discussion_r4538244058
##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -742,6 +744,46 @@ def
test_startup_xcom_cleanup_keys_belong_to_the_starting_try(
assert response.status_code == 200
assert response.json()["xcom_keys_to_clear"] == ["own"]
+ @pytest.mark.parametrize(
+ "conf_value",
+ [
+ pytest.param(-(2**63), id="min-int64"),
+ pytest.param(2**64 - 1, id="max-uint64"),
+ pytest.param(
+ -(2**63) - 1,
+ id="below-int64",
+ marks=pytest.mark.backend("postgres", "sqlite"),
+ ),
+ pytest.param(
+ 2**64,
+ id="above-uint64",
+ marks=pytest.mark.backend("postgres", "sqlite"),
+ ),
+ pytest.param(str(2**64), id="large-number-string"),
+ ],
+ )
+ def test_run_conf_can_be_sent_to_task_runner(self, client, session,
create_task_instance, conf_value):
+ ti = create_task_instance(task_id="large_integer_conf",
state=State.QUEUED)
+ ti.dag_run.conf = {"large_integer": conf_value}
+ session.commit()
+ session.expire_all()
+ assert ti.dag_run.conf == {"large_integer": conf_value}
+
+ response = client.patch(
+ f"/execution/task-instances/{ti.id}/run",
+ json={
+ "state": "running",
+ "hostname": "test-worker",
+ "unixname": "airflow",
+ "pid": 100,
+ "start_date": "2024-10-31T12:00:00Z",
+ },
+ )
+ assert response.status_code == 200, response.text
+ context = TIRunContext.model_validate_json(response.content)
+ assert context.dag_run.conf == {"large_integer": conf_value}
+ _ResponseFrame(id=0, body={"ti_context":
context.model_dump()}).as_bytes()
Review Comment:
That last call was intended to verify that the actual API response could be
serialized without raising OverflowError. However, it mixed SDK serialization
checks into the API test, so I removed the call and its import. The API test
checks persistence and response values, while SDK tests cover serialization and
task startup.
--
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]