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


##########
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:
   Yeah, haha. I was keeping the reschedule date to a much later date on 
purpose. Let me move it closer
   
   > Why this? i.e. string to date to string?
   No specific reason, I will just directly use the string. Direclty passing 
string now



##########
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:
   Yeah, haha. I was keeping the reschedule date to a much later date on 
purpose. Let me move it closer
   
   > Why this? i.e. string to date to string?
   
   No specific reason, I will just directly use the string. Direclty passing 
string now



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