itayweb commented on code in PR #61550:
URL: https://github.com/apache/airflow/pull/61550#discussion_r3423918395
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py:
##########
@@ -2725,6 +2725,114 @@ def
test_custom_timetable_generate_run_id_for_manual_trigger(self, dag_maker, te
run = session.scalars(select(DagRun).where(DagRun.run_id ==
run_id_without_logical_date)).one()
assert run.dag_id == custom_dag_id
+ @pytest.mark.usefixtures("configure_git_connection_for_dag_bundle")
+ def test_trigger_dag_run_with_bundle_version(self, test_client, session,
dag_maker):
+ """Test triggering a DAG run with a specific bundle version."""
+ from tests_common.test_utils.dag import sync_dag_to_db
+
+ dag_id = "test_bundle_version_dag"
+ bundle_name = "testing_bundle"
+
+ with dag_maker(
+ dag_id=dag_id,
+ bundle_name=bundle_name,
+ bundle_version="v1",
+ session=session,
+ ) as dag1:
+ EmptyOperator(task_id="task_1")
+ sync_dag_to_db(dag1, bundle_name=bundle_name)
+
+ with dag_maker(
+ dag_id=dag_id,
+ bundle_name=bundle_name,
+ bundle_version="v2",
+ session=session,
+ ) as dag2:
+ EmptyOperator(task_id="task_1")
+ EmptyOperator(task_id="task_2")
+ sync_dag_to_db(dag2, bundle_name=bundle_name)
+
+ response = test_client.post(
+ f"/dags/{dag_id}/dagRuns", json={"logical_date":
"2024-01-01T00:00:00Z", "bundle_version": "v1"}
+ )
+ assert response.status_code == 200
+ assert response.json()["dag_versions"][0]["bundle_version"] == "v1"
Review Comment:
Done
##########
airflow-core/src/airflow/api_fastapi/execution_api/datamodels/taskinstance.py:
##########
@@ -338,6 +338,7 @@ class DagRun(StrictBaseModel):
consumed_asset_events: list[AssetEventDagRunReference]
partition_key: str | None
note: str | None = None
+ bundle_version: str | None = None
Review Comment:
Done
--
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]