feat: 31 new tests, metrics LLM counters, Dockerfile caching, Makefile targets, compose limits, code fixes

This commit is contained in:
Marker689
2026-05-11 23:08:09 +03:00
parent 20bf7e6745
commit 18efcf482e
26 changed files with 840 additions and 12 deletions

34
tests/test_config.py Normal file
View File

@@ -0,0 +1,34 @@
"""Tests for config module — _env_int error path."""
import os
from unittest.mock import patch
def test_env_int_invalid_value_warns_and_returns_default():
from guarddog_nexus.config import _env_int
os.environ["TEST_PORT"] = "notanumber"
with patch("logging.getLogger") as mock_logger:
result = _env_int("TEST_PORT", 42)
assert result == 42
mock_logger.return_value.warning.assert_called_once()
del os.environ["TEST_PORT"]
def test_env_int_missing_returns_default():
from guarddog_nexus.config import _env_int
os.environ.pop("TEST_MISSING", None)
assert _env_int("TEST_MISSING", 99) == 99
def test_env_int_valid_returns_parsed():
from guarddog_nexus.config import _env_int
os.environ["TEST_VALID"] = "8080"
assert _env_int("TEST_VALID", 42) == 8080
del os.environ["TEST_VALID"]