fix(syslog): a row from before the name split, last seen as a device, stays that device's (#6096)
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 1m29s
CI / integration (push) Successful in 1m39s
CI / publish (push) Successful in 19s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 12:16:08 -04:00
co-authored by Claude Opus 5.5
parent db185fa9e2
commit 5ce3dfe69d
2 changed files with 23 additions and 0 deletions
+14
View File
@@ -99,6 +99,20 @@ def test_devices_through_dockers_address_are_told_apart_by_name(app, monkeypatch
got = sorted((r.address, r.sender, r.lines_total, r.last_line) for r in rows)
assert got == [("10.0.0.2", "AsusNAS", 2, "d"), ("10.0.0.2", "SynNAS", 2, "c"),
("10.9.0.1", "", 1, "e")]
await s.execute(delete(SyslogSource))
await s.commit()
# A row from before the split, last seen under a device's name, is that device's.
async with app.db_sessionmaker() as s:
async with s.begin():
s.add(SyslogSource(address="10.0.0.3", state="accepted", name="DS923", hostname_seen="DS923",
first_seen_at=now, last_seen_at=now, lines_total=3))
async with app.db_sessionmaker() as s:
async with s.begin():
await receiver.store_lines(s, [line("10.0.0.3", "DS923", "f"), line("10.0.0.3", "util", "g")])
async with app.db_sessionmaker() as s:
rows = (await s.execute(select(SyslogSource))).scalars().all()
got = sorted((r.sender, r.state, r.name, r.lines_total) for r in rows)
assert got == [("DS923", "accepted", "DS923", 4), ("util", "offered", "", 1)]
async with app.db_sessionmaker() as s:
async with s.begin():
await s.execute(delete(SyslogSource))