af60ca446d
The fabledscryer->steward rename had only ever reached host_agent. The other five bundled plugins (http, snmp, traefik, unifi, docker) still imported `from fabledscryer.*` (package no longer exists) and read FABLEDSCRYER_* env vars — so every one of them was broken at import since the original rebrand. CI stayed green only because none are enabled by default and migrations don't import plugin modules. Now that they version in-tree, complete the rename: - fabledscryer.* -> steward.* imports across all five plugins - FABLEDSCRYER_* -> STEWARD_* in plugin migration env.py files - author/repository/homepage + user-facing 'Fabled Scryer' strings -> Steward - snmp/scheduler.py: also drop dead `now`/datetime; record_metric from steward Adds tests/test_no_legacy_names.py — fails if 'scryer'/'roundtable' ever reappear in shipped code (the drift bit twice; this stops a third time). Also clears pre-existing ruff lint debt (unused imports, semicolon statements, mid-file import) surfaced by the new lint lane. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
626 B
Python
28 lines
626 B
Python
from plugins.host_agent.agent import RingBuffer
|
|
|
|
|
|
def test_ring_buffer_preserves_order():
|
|
rb = RingBuffer(maxlen=3)
|
|
rb.push(1)
|
|
rb.push(2)
|
|
rb.push(3)
|
|
assert list(rb.drain()) == [1, 2, 3]
|
|
assert len(rb) == 0
|
|
|
|
|
|
def test_ring_buffer_drops_oldest_when_full():
|
|
rb = RingBuffer(maxlen=3)
|
|
for v in (1, 2, 3, 4, 5):
|
|
rb.push(v)
|
|
assert list(rb.drain()) == [3, 4, 5]
|
|
|
|
|
|
def test_ring_buffer_drain_clears_and_is_atomic():
|
|
rb = RingBuffer(maxlen=5)
|
|
rb.push("a")
|
|
rb.push("b")
|
|
out = list(rb.drain())
|
|
rb.push("c")
|
|
assert out == ["a", "b"]
|
|
assert list(rb.drain()) == ["c"]
|