SIGN IN SIGN UP

mgr/snap_schedule: narrow the race in test_start_default_midnight

Same root cause as the previous commit's test_created_now fix: start and
created come from two separate datetime.now() calls in
Schedule.__init__ (schedule.py:111 and :119), and the test compared
start's day/month/year against a third, freshly read now() in the test
body. A UTC midnight rollover between any of those reads legitimately
breaks the comparison. Rarer than test_created_now's minute-boundary
race and hasn't actually been reported, but the same bug.

Compare against created's date instead: created and start are set
microseconds apart in the same __init__ call, about as tight a window as
we can get without giving Schedule an injectable clock.

Fixes: https://tracker.ceph.com/issues/79957
Signed-off-by: Kefu Chai <k.chai@proxmox.com>
K
Kefu Chai committed
98ec688f5a55f618d9d4f042351624d056af43c1
Parent: 2ec8f9c