CI / Lint (flake8, house style) (pull_request) Successful in 54s
CI / Test (pytest) (pull_request) Successful in 55s
CI / Security (bandit, pip-audit) (pull_request) Successful in 56s
CI / Integration (MariaDB) (pull_request) Successful in 2m2s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 1m30s
CI / Deploy (pull_request) Skipped
- checks/reboots.py (thor#4): boot-time changes classified as planned (logind line), unexpected, or unknown (journal went quiet first); several together are one event. - checks/cluster.py: HA fence lines, watchdog self-fences, corosync quorum loss: one host is 'lost its cluster link and was fenced' (P2), two or more a cluster partition (P1). - checks/maintenance.py: Gandalf suppressions (with ended ones) as a cause that never opens a ticket; everything under it goes on the timeline. - Engine: higher causes first, lower causes they explain become symptoms; a higher cause found later absorbs pending ones and comments 'Root cause' on opened ones; host-scoped causes never explain another host's cause; incidents stay active while an attached host is still down; silent state changes are saved; notes join timeline-only incidents. - Known conditions (migration 3, seeded): compute-storage-02 reboots and Ceph noout -> 693930698, the old UPS battery. A match sends a note to that ticket instead of a new one. - Replays: T2 0 tickets; T3 one P2 (fenced, cleared when the host is back); T4 one P1 partition (storage-01's later fence and all reboots fold in); DIMM one note on 693930698. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
112 lines
4.5 KiB
Python
112 lines
4.5 KiB
Python
"""Replays for the other incidents in the plan on thor#1 (Area 7).
|
|
|
|
* T2, 2026-11-25: planned rack maintenance. Zero tickets.
|
|
* T3, 2026-10-27: compute-storage-01 lost its only corosync link, was fenced, down 3.5 hours. One ticket.
|
|
* T4, 2026-11-04: corosync partition, three nodes fenced. One ticket.
|
|
* DIMM, 2026-11-21: compute-storage-02's known failing DIMM. No ticket, one note on 693930698.
|
|
"""
|
|
from datetime import datetime, timezone
|
|
|
|
import pytest
|
|
|
|
from .replay import Replay
|
|
|
|
|
|
def hm(ts: float) -> str:
|
|
return datetime.fromtimestamp(ts, tz=timezone.utc).strftime('%H:%M')
|
|
|
|
|
|
@pytest.fixture(scope='module')
|
|
def t2():
|
|
return Replay('t2').run()
|
|
|
|
|
|
@pytest.fixture(scope='module')
|
|
def t3():
|
|
return Replay('t3').run()
|
|
|
|
|
|
@pytest.fixture(scope='module')
|
|
def t4():
|
|
return Replay('t4').run()
|
|
|
|
|
|
@pytest.fixture(scope='module')
|
|
def dimm():
|
|
return Replay('dimm').run()
|
|
|
|
|
|
# -- T2: planned maintenance ------------------------------------------------
|
|
def test_t2_planned_maintenance_opens_no_ticket(t2):
|
|
assert t2.actions() == []
|
|
|
|
|
|
def test_t2_everything_lands_on_the_maintenance_timeline(t2):
|
|
inc = t2.store.incidents['maintenance:gandalf:2']
|
|
assert inc['ticket'] is False and inc['state'] == 'cleared'
|
|
assert inc['summary'] == 'Planned maintenance (switch update, by jared)'
|
|
rebooted = {s['subject'] for s in inc['symptoms'].values() if s['kind'] in ('reboot', 'reboot_planned')}
|
|
# Every rack host and compute-storage-02 came back with a new boot time.
|
|
assert rebooted >= {'compute-storage-01', 'compute-storage-02', 'compute-storage-gpu-01', 'storage-01',
|
|
'monitor-01', 'monitor-02'}
|
|
assert set(t2.store.incidents) == {'maintenance:gandalf:2'}
|
|
|
|
|
|
def test_t2_thor_was_dark_and_caught_up(t2):
|
|
caught_up = [r for r in t2.results if r.catching_up]
|
|
assert caught_up, 'the first cycle after the outage reviews the whole gap'
|
|
assert caught_up[0].window[1] - caught_up[0].window[0] > 20 * 60
|
|
|
|
|
|
# -- T3: one host fenced ------------------------------------------------------
|
|
def test_t3_one_ticket_for_the_fenced_host(t3):
|
|
opened = t3.opened()
|
|
assert len(opened) == 1
|
|
p = opened[0]['payload']
|
|
assert opened[0]['incident_key'] == 'host:compute-storage-01:fenced'
|
|
assert p['priority'] == 2
|
|
assert p['title'] == ('[compute-storage-01][auto][thor][software] compute-storage-01 lost its cluster link and '
|
|
'was fenced [single-node][production][issue]')
|
|
assert '15:55' <= hm(opened[0]['created']) <= '15:59'
|
|
|
|
|
|
def test_t3_ceph_fallout_and_the_late_reboot_attach_to_it(t3):
|
|
inc = t3.store.incidents['host:compute-storage-01:fenced']
|
|
kinds = {(s['kind'], s['subject']) for s in inc['symptoms'].values()}
|
|
assert ('ceph_alert', 'cluster') in kinds
|
|
assert ('scrape', 'compute-storage-01') in kinds
|
|
names = {k.split(':')[-1] for k in inc['symptoms'] if k.startswith('cluster:ceph_alert:')}
|
|
assert {'MON_DOWN', 'OSD_HOST_DOWN', 'OSD_DOWN'} <= names
|
|
# The host stayed down until 19:20; the incident stays open while it is down, then clears.
|
|
assert inc['state'] == 'cleared'
|
|
assert set(t3.store.incidents) == {'host:compute-storage-01:fenced'}
|
|
|
|
|
|
# -- T4: partition --------------------------------------------------------------
|
|
def test_t4_one_ticket_for_the_partition(t4):
|
|
opened = t4.opened()
|
|
assert len(opened) == 1
|
|
assert opened[0]['incident_key'] == 'cluster:corosync:partition'
|
|
assert opened[0]['payload']['priority'] == 1
|
|
assert opened[0]['payload']['title'].startswith('[proxmox-cluster][auto][thor][software] Cluster partition: ')
|
|
assert '20:52' <= hm(opened[0]['created']) <= '20:56'
|
|
assert {a['incident_key'] for a in t4.actions()} == {'cluster:corosync:partition'}
|
|
|
|
|
|
def test_t4_late_fence_and_reboots_fold_into_the_partition(t4):
|
|
inc = t4.store.incidents['cluster:corosync:partition']
|
|
assert 'storage-01' in inc['summary'] # fenced at 20:54, seen later on its own
|
|
assert 'host:storage-01:fenced' in inc['symptoms']
|
|
assert {'host:compute-storage-01:reboot', 'host:compute-storage-gpu-01:reboot'} <= set(inc['symptoms'])
|
|
assert inc['state'] == 'cleared'
|
|
|
|
|
|
# -- DIMM: known condition ------------------------------------------------------
|
|
def test_dimm_reboot_is_a_note_on_its_known_ticket_not_a_new_ticket(dimm):
|
|
assert dimm.opened() == []
|
|
notes = dimm.actions('known_note')
|
|
assert len(notes) == 1
|
|
assert notes[0]['payload']['ticket_id'] == '693930698'
|
|
assert 'compute-storage-02' in notes[0]['payload']['comment']
|
|
assert dimm.store.incidents['host:compute-storage-02:reboot']['state'] == 'cleared'
|