Phase 1, PR 1: skeleton (config, source clients, DB, monitor loop, health, CI, deploy) #5
No files matched your search
@@ -176,3 +176,21 @@ def test_stop_ends_run_forever():
|
||||
m.settings.cycle_seconds = 1
|
||||
m.stop()
|
||||
m.run_forever() # returns at once
|
||||
|
||||
|
||||
def test_restart_while_db_away_still_catches_up_once_db_answers():
|
||||
"""T2 order: the rack comes back, Thor starts before CT 149 does."""
|
||||
store = FakeStore()
|
||||
m, clock = make(store)
|
||||
m.cycle()
|
||||
went_dark = clock.t
|
||||
clock.advance(22 * 60)
|
||||
store.down = True
|
||||
m2, _ = make(store, clock=clock)
|
||||
first = m2.cycle()
|
||||
assert first.window == (clock.t - 120, clock.t) # nothing known yet
|
||||
clock.advance(120)
|
||||
store.down = False
|
||||
second = m2.cycle()
|
||||
# The stored end wins, so the whole time Thor was away is reviewed, not just the last cycle.
|
||||
assert second.window == (went_dark, clock.t) and second.catching_up
|
||||
@@ -121,6 +121,8 @@ class Monitor:
|
||||
except DatabaseError as e:
|
||||
logger.warning('Could not load previous state yet: %s', e)
|
||||
return
|
||||
# The stored end is at or before anything this process reviewed while the database
|
||||
# was away, so it wins: the next window then covers the whole time Thor was gone.
|
||||
if isinstance(end, (int, float)):
|
||||
self.last_good_end = float(end)
|
||||
for name, st in statuses.items():
|
||||
|
||||
Reference in new issue
Block a user