"""工程配置校验单元测试（Redis 缓存 TTL fail-loud）。"""

from __future__ import annotations

import pytest


def test_redis_cache_ttl_zero_rejected() -> None:
    """REDIS_CACHE_TTL<=0 必须启动即报错，消灭'0=永不过期'隐式语义。"""
    from adapters.redis_cache import _resolve_cache_ttl

    with pytest.raises(ValueError, match="REDIS_CACHE_TTL"):
        _resolve_cache_ttl(0)
    with pytest.raises(ValueError, match="REDIS_CACHE_TTL"):
        _resolve_cache_ttl(-1)
    assert _resolve_cache_ttl(86400) == 86400
