fix(norms): templates grade by the cutoffs when handed no grade; the parts test reads inside transactions (#5742)
CI 9128: the host vitals and monitor templates required the new grades, so callers (and tests) that render them without one failed; they now fall back to status_class. The new integration test read outside begin(), which autobegan the session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -360,15 +360,19 @@ def test_a_metric_learned_without_its_parts_ignores_them(app, src):
|
||||
s.add_all(rows)
|
||||
async with s.begin():
|
||||
await rebuild_norms(s, NOW)
|
||||
learned = await norms_at(s, [(src, host, METRIC), (src, part, METRIC)], NOW.replace(hour=14))
|
||||
async with s.begin():
|
||||
learned = await norms_at(s, [(src, host, METRIC), (src, part, METRIC)],
|
||||
NOW.replace(hour=14))
|
||||
async with s.begin():
|
||||
await _report(s, src, host, at, 90.0)
|
||||
await _report(s, src, part, at, 90.0)
|
||||
levels = await levels_now(s, at)
|
||||
async with s.begin():
|
||||
levels = await levels_now(s, at)
|
||||
async with s.begin():
|
||||
await detect(s, at)
|
||||
opened = list((await s.execute(select(MetricAnomaly.resource_name).where(
|
||||
MetricAnomaly.source_module == src))).scalars())
|
||||
async with s.begin():
|
||||
opened = list((await s.execute(select(MetricAnomaly.resource_name).where(
|
||||
MetricAnomaly.source_module == src))).scalars())
|
||||
return learned, levels, opened
|
||||
|
||||
learned, levels, opened = asyncio.run(_go())
|
||||
|
||||
Reference in New Issue
Block a user