feat(v2): complete v2 reimplementation
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
import pytest
|
||||
from backup_tool.scheduler import next_nominal
|
||||
|
||||
|
||||
def test_misfire_window_is_deterministic_for_delivery() -> None:
|
||||
nominal = datetime.now(UTC) - timedelta(seconds=901)
|
||||
next_run = next_nominal("* * * * *", "UTC", nominal)
|
||||
|
||||
assert next_run > nominal
|
||||
assert (datetime.now(UTC) - nominal).total_seconds() > 900
|
||||
|
||||
|
||||
@pytest.mark.parametrize("cron", ["* * * * * *", "invalid"])
|
||||
def test_delivery_rejects_invalid_cron_before_enqueue(cron: str) -> None:
|
||||
with pytest.raises(ValueError):
|
||||
next_nominal(cron, "UTC")
|
||||
Reference in New Issue
Block a user