test(syslog): a preset's 15-minute window doesn't reach the 40-minute-old nfsd line (#6001)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -332,6 +332,7 @@ def test_patterns_page_adds_edits_and_removes_and_a_rename_moves_counts(app):
|
|||||||
assert rows["nfs"].phrases[0] == "nfsd:"
|
assert rows["nfs"].phrases[0] == "nfsd:"
|
||||||
|
|
||||||
await patterns.record_counts(app, now)
|
await patterns.record_counts(app, now)
|
||||||
|
assert await _latest(app, "lines_matching_nfs") == {src_name: 0.0}
|
||||||
page = await (await admin.get("/plugins/syslog/patterns")).get_data(as_text=True)
|
page = await (await admin.get("/plugins/syslog/patterns")).get_data(as_text=True)
|
||||||
assert "Quota full" in page and "NFS server trouble" in page
|
assert "Quota full" in page and "NFS server trouble" in page
|
||||||
assert "metric_name=lines_matching_quota_full" in page
|
assert "metric_name=lines_matching_quota_full" in page
|
||||||
@@ -353,7 +354,9 @@ def test_patterns_page_adds_edits_and_removes_and_a_rename_moves_counts(app):
|
|||||||
renamed = await admin.post(f"/plugins/syslog/sources/{src_id}/edit", headers=csrf,
|
renamed = await admin.post(f"/plugins/syslog/sources/{src_id}/edit", headers=csrf,
|
||||||
form={"name": "Big NAS", "host_id": ""})
|
form={"name": "Big NAS", "host_id": ""})
|
||||||
assert renamed.status_code == 302
|
assert renamed.status_code == 302
|
||||||
assert await _latest(app, "lines_matching_nfs") == {"Big NAS": 1.0}
|
# (0: a preset's window is 15 minutes, and the nfsd line is 40 old;
|
||||||
|
# no count has run since, so the row under the new name was moved.)
|
||||||
|
assert await _latest(app, "lines_matching_nfs") == {"Big NAS": 0.0}
|
||||||
|
|
||||||
removed = await admin.post(f"/plugins/syslog/patterns/{rows['nfs'].id}/delete", headers=csrf)
|
removed = await admin.post(f"/plugins/syslog/patterns/{rows['nfs'].id}/delete", headers=csrf)
|
||||||
assert removed.status_code == 302
|
assert removed.status_code == 302
|
||||||
|
|||||||
Reference in New Issue
Block a user