Test: restart while the database is away still catches up once it answers (T2 order)
CI / Test (pytest) (pull_request) Successful in 52s
CI / Integration (MariaDB) (pull_request) Successful in 1m50s
CI / Security (bandit, pip-audit) (pull_request) Successful in 1m4s
CI / Lint (flake8, house style) (pull_request) Successful in 58s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 2m57s
CI / Deploy (pull_request) Skipped
CI / Test (pytest) (pull_request) Successful in 52s
CI / Integration (MariaDB) (pull_request) Successful in 1m50s
CI / Security (bandit, pip-audit) (pull_request) Successful in 1m4s
CI / Lint (flake8, house style) (pull_request) Successful in 58s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 2m57s
CI / Deploy (pull_request) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b0e240af50
commit
f3d0b5e11a
2 files changed
+20
No files matched your search
@@ -176,3 +176,21 @@ def test_stop_ends_run_forever():
|
|||||||
m.settings.cycle_seconds = 1
|
m.settings.cycle_seconds = 1
|
||||||
m.stop()
|
m.stop()
|
||||||
m.run_forever() # returns at once
|
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:
|
except DatabaseError as e:
|
||||||
logger.warning('Could not load previous state yet: %s', e)
|
logger.warning('Could not load previous state yet: %s', e)
|
||||||
return
|
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)):
|
if isinstance(end, (int, float)):
|
||||||
self.last_good_end = float(end)
|
self.last_good_end = float(end)
|
||||||
for name, st in statuses.items():
|
for name, st in statuses.items():
|
||||||
|
|||||||
Reference in new issue
Block a user