Ceph flags: "set since before <date>" when older than Thor's flag history #15

Merged
jared merged 1 commits from flag-since-before into main 2026-11-27 12:46:22 -05:00
2 changed files with 7 additions and 2 deletions

No files matched your search

+4 -1
View File
@@ -281,7 +281,10 @@ def test_a_known_condition_matches_a_flag_by_its_name():
e.process([f], T0)
acts = e.process([f], T0 + 120)
assert [(a.kind, a.payload.get('ticket_id')) for a in acts] == [('known_note', '693930698')]
assert e.incidents['cluster:ceph_flag:noout'].summary.startswith('Ceph flag noout set since ')
assert e.incidents['cluster:ceph_flag:noout'].summary.startswith('Ceph flag noout set since 20')
f.facts['run_start_open'] = True
e.process([f], T0 + 240)
assert e.incidents['cluster:ceph_flag:noout'].summary.startswith('Ceph flag noout set since before 20')
def test_ticket_text_says_when_the_start_is_only_a_lower_bound():
+3 -1
View File
@@ -392,7 +392,9 @@ class CephCheck:
# Stable text: a summary that changes every cycle would re-send the ticket every 30 min.
from ..ticket_text import utc
since = utc(inc.facts.get('run_start', inc.first_seen))[:16] + ' UTC'
return f'Ceph flag {inc.facts.get("flag")} set since {since}'
# Set since before Thor's 24 h of flag history: the date is only a lower bound.
word = 'before ' if inc.facts.get('run_start_open') else ''
return f'Ceph flag {inc.facts.get("flag")} set since {word}{since}'
return inc.summary
@staticmethod