Skip to content

Commit

Permalink
Fix missing logical_date in DagRun for DMS operator tests (apache#46521)
Browse files Browse the repository at this point in the history
* Add logical in the tests

* Fix compact test
  • Loading branch information
sunank200 authored and insomnes committed Feb 6, 2025
1 parent b1d1cd4 commit 69ce43e
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions providers/tests/amazon/aws/operators/test_dms.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,25 +477,35 @@ def test_init(self):
@pytest.mark.db_test
@mock.patch.object(DmsHook, "conn")
def test_template_fields_native(self, mock_conn, session):
execution_date = timezone.datetime(2020, 1, 1)
logical_date = timezone.datetime(2020, 1, 1)
Variable.set("test_filter", self.filter, session=session)

dag = DAG(
"test_dms",
schedule=None,
start_date=execution_date,
start_date=logical_date,
render_template_as_native_obj=True,
)
op = DmsDescribeReplicationConfigsOperator(
task_id="test_task", filter="{{ var.value.test_filter }}", dag=dag
)

dag_run = DagRun(
dag_id=dag.dag_id,
run_id="test",
run_type=DagRunType.MANUAL,
state=DagRunState.RUNNING,
)
if AIRFLOW_V_3_0_PLUS:
dag_run = DagRun(
dag_id=dag.dag_id,
run_id="test",
run_type=DagRunType.MANUAL,
state=DagRunState.RUNNING,
logical_date=logical_date,
)
else:
dag_run = DagRun(
dag_id=dag.dag_id,
run_id="test",
run_type=DagRunType.MANUAL,
state=DagRunState.RUNNING,
execution_date=logical_date,
)
ti = TaskInstance(task=op)
ti.dag_run = dag_run
session.add(ti)
Expand Down

0 comments on commit 69ce43e

Please sign in to comment.