mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-08-04 11:58:36 +00:00
test(schedule): stop the once-task router case expiring
`test_a_timezone_change_on_a_once_task_keeps_the_same_instant` pinned a literal `2026-08-01T09:00:00+00:00`. These routes run against the real clock -- unlike the domain suite, they inject no `now=` -- and a `once` schedule must be in the future, so the case passed until that date went by and then failed on every run with a 422. Builds the instant relative to now instead. The assertions only compare created against updated, so nothing depended on the literal value. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
85a591751a
commit
8ef0f002ba
@ -101,6 +101,11 @@ def _create_body(**overrides):
|
||||
return router_module.CreateScheduledTaskRequest(**{**defaults, **overrides})
|
||||
|
||||
|
||||
def _future_iso(*, days: int) -> str:
|
||||
"""An offset-aware instant safely in the future, as the wire spells it."""
|
||||
return (datetime.now(UTC) + timedelta(days=days)).isoformat()
|
||||
|
||||
|
||||
def _update_body(**fields):
|
||||
return router_module.UpdateScheduledTaskRequest(**fields)
|
||||
|
||||
@ -349,7 +354,11 @@ class TestUpdate:
|
||||
created = await _create(
|
||||
service,
|
||||
schedule_type="once",
|
||||
schedule_spec={"run_at": "2026-08-01T09:00:00+00:00"},
|
||||
# Relative to now, not a literal: these routes run against the real
|
||||
# clock (no `now=` injection), and `once` schedules must be in the
|
||||
# future -- a hardcoded instant turns the test into a time bomb
|
||||
# that passes until the date quietly goes by.
|
||||
schedule_spec={"run_at": _future_iso(days=30)},
|
||||
timezone="UTC",
|
||||
)
|
||||
updated = await _call(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user