kaxil commented on code in PR #44907:
URL: https://github.com/apache/airflow/pull/44907#discussion_r1890073332


##########
tests/api_fastapi/execution_api/routes/test_task_instances.py:
##########
@@ -286,6 +286,57 @@ def test_ti_update_state_to_deferred(self, client, 
session, create_task_instance
         assert t[0].classpath == "my-classpath"
         assert t[0].kwargs == {"key": "value"}
 
+    def test_ti_update_state_to_reschedule(self, client, session, 
create_task_instance, time_machine):
+        """
+        Test that tests if the transition to reschedule state is handled 
correctly.
+        """
+
+        from math import ceil
+
+        instant = timezone.datetime(2024, 10, 30)
+        time_machine.move_to(instant, tick=False)
+
+        ti = create_task_instance(
+            task_id="test_ti_update_state_to_reschedule",
+            state=State.RUNNING,
+            session=session,
+        )
+        ti.start_date = instant
+        ti.end_date = DEFAULT_END_DATE
+        session.commit()
+
+        payload = {
+            "state": "up_for_reschedule",
+            "reschedule_date": 
timezone.parse("2025-1-1T12:00:00Z").isoformat(),

Review Comment:
   Why this? i.e. string to date to string?
   
   also the start date vs reschedule date vs end date are poles apart :) 
   
   
   ```
   DEFAULT_START_DATE = timezone.parse("2024-10-31T11:00:00Z")
   DEFAULT_END_DATE = timezone.parse("2024-10-31T12:00:00Z")
   reschedule_date = timezone.parse("2025-1-1T12:00:00Z")
   ```
   
   



-- 
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