fat-catTW commented on code in PR #69830:
URL: https://github.com/apache/airflow/pull/69830#discussion_r3604713670
##########
airflow-core/tests/unit/dag_processing/test_manager.py:
##########
@@ -2712,6 +2712,30 @@ def test_get_bundle_state_returns_correct_state(self,
session):
assert state == BundleState(last_refreshed=refreshed_at, version="v1")
+ def test_get_bundle_state_reads_latest_database_values(self, session):
+ bundle_name = "test_fresh_state_bundle"
+ initial_refreshed_at = timezone.datetime(2024, 1, 15, 12, 0, 0)
+ refreshed_at = timezone.datetime(2024, 1, 16, 12, 0, 0)
+ model = DagBundleModel(name=bundle_name, version="old")
+ model.last_refreshed = initial_refreshed_at
+ session.add(model)
+ session.commit()
+
+ manager = DagFileProcessorManager(max_runs=1)
+ state = manager.get_bundle_state(bundle_name, session=session)
+
+ assert state == BundleState(last_refreshed=initial_refreshed_at,
version="old")
+
+ with create_session() as update_session:
+ update_model = update_session.get(DagBundleModel, bundle_name)
+ assert update_model is not None
+ update_model.last_refreshed = refreshed_at
+ update_model.version = "fresh"
+
+ state = manager.get_bundle_state(bundle_name, session=session)
Review Comment:
Got it.
--
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]