79일차 운영 데이터 기반 Ops Assistant: 실습 15개 · 강의(개요 30장 · 단계 문서 · 4단계 정리 · 05 바이브), 정답본 LAB-A · answers · VIBE-A · tops 포함
This commit is contained in:
1 parent
9ce9aceba6
commit
6f0ecd59a9
156 files changed
+31640
No files matched your search
@@ -0,0 +1,38 @@
|
||||
"""R5 · R13: tops calls only the read addresses; n8n off is a read error, not a crash."""
|
||||
import pytest
|
||||
|
||||
from tops import client
|
||||
|
||||
|
||||
def test_only_read_addresses(fake):
|
||||
with pytest.raises(ValueError):
|
||||
client.post(fake.base, "/dlq/update", {"id": 1})
|
||||
with pytest.raises(ValueError):
|
||||
client.post(fake.base, "/ops-reset", {})
|
||||
assert fake.calls == []
|
||||
|
||||
|
||||
def test_facts_sends_the_period(fake):
|
||||
client.facts(fake.base, date_from="2026-10-19", date_to="2026-10-23")
|
||||
assert fake.calls == [("/webhook/my-ops-facts", {"from": "2026-10-19", "to": "2026-10-23"})]
|
||||
|
||||
|
||||
def test_file_wins_over_n8n(fake, tmp_path):
|
||||
f = client.facts(fake.base, file=str(__import__("pathlib").Path(__file__).parent / "data" / "facts.json"))
|
||||
assert f["overall"] == "red" and fake.calls == []
|
||||
|
||||
|
||||
def test_facts_without_health_is_refused(tmp_path):
|
||||
p = tmp_path / "old.json"
|
||||
p.write_text('{"runs": {}}')
|
||||
with pytest.raises(client.ReadError, match="health"):
|
||||
client.facts(file=str(p))
|
||||
|
||||
|
||||
def test_n8n_off_is_read_error(down):
|
||||
with pytest.raises(client.ReadError):
|
||||
client.ask(down, "지난주 오류율이 얼마야?")
|
||||
|
||||
|
||||
def test_http_error_body_is_returned(fake):
|
||||
assert client.evaluate(fake.base, []) == {"error": "cases must be a non-empty list"}
|
||||
Reference in new issue
Block a user