kgskgs commented on code in PR #68947:
URL: https://github.com/apache/airflow/pull/68947#discussion_r3472614291


##########
airflow-core/tests/unit/models/test_serialized_dag.py:
##########
@@ -423,6 +423,27 @@ def 
test_new_dag_versions_are_created_if_there_is_a_dagrun(self, dag_maker, sess
         assert session.scalar(select(func.count()).select_from(DagVersion)) == 
2
         assert session.scalar(select(func.count()).select_from(SDM)) == 2
 
+    def 
test_new_dag_version_is_created_when_version_exists_but_serialized_dag_row_missing(
+        self, dag_maker, session
+    ):
+        with dag_maker("dag1") as dag:
+            PythonOperator(task_id="task1", python_callable=lambda: None)
+        assert session.scalar(select(func.count()).select_from(SDM)) == 1
+        assert session.scalar(select(func.count()).select_from(DagVersion)) == 
1
+
+        # Simulate the broken state: DagVersion present, serialized_dag row 
gone.
+        session.execute(delete(SDM).where(SDM.dag_id == dag.dag_id))
+        session.flush()
+        assert session.scalar(select(func.count()).select_from(SDM)) == 0
+        assert session.scalar(select(func.count()).select_from(DagVersion)) == 
1

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]

Reply via email to