diff options
| author | Christian Cleberg <[email protected]> | 2026-07-20 12:00:19 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-07-20 12:00:19 -0500 |
| commit | c544c1bd6ac7cf9c989abd887067d34b0455bd66 (patch) | |
| tree | 09ff0e2323f7ef9eeef7f0d1c37e82b49b39628e /tests | |
| parent | 084874158aa177757bb83e400bf1eb986b2b7e6c (diff) | |
| download | hutch-stats-c544c1bd6ac7cf9c989abd887067d34b0455bd66.tar.gz hutch-stats-c544c1bd6ac7cf9c989abd887067d34b0455bd66.tar.bz2 hutch-stats-c544c1bd6ac7cf9c989abd887067d34b0455bd66.zip | |
fix: make todo idempotency test timestamps relative to now
test_todo_ingestion_is_idempotent used hardcoded May 2026 event
timestamps, but the poller computes `since` as now - 30 days. Once
wall-clock time passed 2026-06-01 the fixture events fell outside that
window, were skipped by the todo since filter, and the test asserted
0 inserted instead of 3.
Anchor the three fixture timestamps to datetime.now(UTC) while keeping
their original relative ordering, so the test stays inside the poller's
lookback window regardless of when it runs.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_ingestion.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test_ingestion.py b/tests/test_ingestion.py index 81c4084..693d575 100644 --- a/tests/test_ingestion.py +++ b/tests/test_ingestion.py @@ -237,13 +237,15 @@ def branch_payload(*branches: str) -> dict: def test_todo_ingestion_is_idempotent(db_session) -> None: settings = make_settings() + # The poller polls the last 30 days, so keep fixture events inside that window. + now = datetime.now(tz=UTC) payload = { "me": {"canonicalName": "~ccleberg"}, "events": { "results": [ { "id": "1001", - "created": "2026-05-01T10:00:00Z", + "created": (now - timedelta(days=3)).isoformat(), "ticket": { "id": "123", "ref": "~ccleberg/todo/123", @@ -262,7 +264,7 @@ def test_todo_ingestion_is_idempotent(db_session) -> None: }, { "id": "1002", - "created": "2026-05-02T09:00:00Z", + "created": (now - timedelta(days=2, hours=1)).isoformat(), "ticket": { "id": "123", "ref": "~ccleberg/todo/123", @@ -281,7 +283,7 @@ def test_todo_ingestion_is_idempotent(db_session) -> None: }, { "id": "1003", - "created": "2026-05-02T10:00:00Z", + "created": (now - timedelta(days=2)).isoformat(), "ticket": { "id": "123", "ref": "~ccleberg/todo/123", |
