swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f48f8e83f60>
def test_journal_client_origin_visit_status_from_journal_last_uneventful(swh_scheduler):
visit_status = {
"origin": "foo",
"visit": 1,
"status": "full",
"date": DATE3 + ONE_DAY,
"type": "git",
"snapshot": hash_to_bytes("d81cc0710eb6cf9efd5b920a8453e1e07157b6cd"),
}
# Let's insert some visit stats with some previous visit information
swh_scheduler.origin_visit_stats_upsert(
[
OriginVisitStats(
url=visit_status["origin"],
visit_type=visit_status["type"],
last_eventful=DATE1,
last_uneventful=DATE3,
last_failed=DATE2,
last_notfound=DATE1,
last_snapshot=visit_status["snapshot"],
next_visit_queue_position=None,
next_position_offset=4,
)
]
)
process_journal_objects(
{"origin_visit_status": [visit_status]}, scheduler=swh_scheduler
)
actual_origin_visit_stats = swh_scheduler.origin_visit_stats_get(
[(visit_status["origin"], visit_status["type"])]
)
> assert actual_origin_visit_stats == [
OriginVisitStats(
url=visit_status["origin"],
visit_type=visit_status["type"],
last_eventful=DATE1,
last_uneventful=visit_status["date"], # most recent date but uneventful
last_failed=DATE2,
last_notfound=DATE1,
last_snapshot=visit_status["snapshot"],
next_visit_queue_position=None,
next_position_offset=5, # uneventful so visit less often
)
]
E AssertionError: assert [OriginVisitS...ion_offset=5)] == [OriginVisitS...ion_offset=5)]
E At index 0 diff: OriginVisitStats(url='foo', visit_type='git', last_eventful=datetime.datetime(2021, 6, 29, 10, 36, 3, 962269, tzinfo=datetime.timezone.utc), last_uneventful=datetime.datetime(2021, 7, 2, 10, 36, 3, 962269, tzinfo=datetime.timezone.utc), last_failed=datetime.datetime(2021, 6, 30, 10, 36, 3, 962269, tzinfo=datetime.timezone.utc), last_notfound=datetime.datetime(2021, 6, 29, 10, 36, 3, 962269, tzinfo=datetime.timezone.utc), last_scheduled=None, last_snapshot=b'\xd8\x1c\xc0q\x0e\xb6\xcf\x9e\xfd[\x92\n\x84S\xe1\xe0qW\xb6\xcd', next_visit_queue_position=datet...
E
E ...Full output truncated (6 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_journal_client.py:384: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 1 2021, 12:37 PM