mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
test(lint): read the files these tests write without the session cache
Both new tests read a file their own run has just written, which the uncached-read lint flags because utils.cache.files.read_text is an lru_cache with no mtime invalidation. The two cases want different answers. The rendered inventory is YAML, so load_yaml_any reads and parses it the way the lint asks and needs no exception at all. The healthcheck probe writes its request through bash inside the test, so a cached read would compare against the previous run's bytes and the assertion would pass without proving anything; that one keeps a cache-read directive naming why. make test-lint went from 2 failed to green, and the first attempt is the reason the inventory test carries no directive: suppressing the read there only moved the complaint to yaml.safe_load, which the right reader answers in one call. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
dbed5f8077
commit
9ecedfac92
2 files changed
+3
-4
No files matched your search
@@ -136,7 +136,7 @@ class TestOtherFlavors(unittest.TestCase):
|
||||
subprocess.run(["bash", "-c", script], check=True)
|
||||
self.assertEqual(
|
||||
b"GET /health HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n",
|
||||
sent.read_bytes(),
|
||||
sent.read_bytes(), # nocheck: cache-read - bash writes this file inside the test, so a cached read would answer with the previous run's bytes
|
||||
)
|
||||
|
||||
def test_http_status_demands_a_2xx_or_3xx_status_line(self):
|
||||
|
||||
@@ -4,9 +4,8 @@ from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
import yaml
|
||||
|
||||
from utils import PROJECT_ROOT
|
||||
from utils.cache.yaml import load_yaml_any
|
||||
from utils.inventory.tools import LANE_MODEL_ALIAS, render
|
||||
|
||||
OLLAMA_ROLE = "svc-ai-ollama"
|
||||
@@ -23,7 +22,7 @@ class TestLaneModel(unittest.TestCase):
|
||||
the probe expects another never reports ready and redeploys on every
|
||||
call.
|
||||
"""
|
||||
rendered = yaml.safe_load(render(PROJECT_ROOT, ["en"]).read_text("utf-8"))
|
||||
rendered = load_yaml_any(str(render(PROJECT_ROOT, ["en"])))
|
||||
ollama = rendered["applications"][OLLAMA_ROLE]["services"]["ollama"]
|
||||
|
||||
self.assertEqual(
|
||||
|
||||
Reference in new issue
Block a user