test: cover the env-key messages left unguarded by mutation testing
Mutation testing showed the negative structured-retries and expected-dim checks in the env parsing path could be deleted with every test still passing. Their value is the env key name in the message, so they need tests that assert it. Changelog now states the real scope of this release and warns that normalising scope moves the Redis keys, the one change here that silently relocates runtime state. Records the breaker threshold derivation as deliberately env-only so it does not resurface as another round.
This commit is contained in:
@@ -171,6 +171,11 @@ class TestAssemblyGuards:
|
||||
s2 = GatewaySettings.from_env("LLM", env=_env(PGW_STRUCTURED_MAX_RETRIES="0"))
|
||||
assert s2.structured_max_retries == 0
|
||||
|
||||
def test_negative_structured_retries_rejected_with_env_key(self):
|
||||
"""env 层的检查保留是为了报错能点出键名(构造期那道点的是字段名)。"""
|
||||
with pytest.raises(ValueError, match="PGW_STRUCTURED_MAX_RETRIES"):
|
||||
GatewaySettings.from_env("LLM", env=_env(PGW_STRUCTURED_MAX_RETRIES="-1"))
|
||||
|
||||
def test_cache_requires_namespace_and_ttl(self):
|
||||
env = _env(PGW_CACHE_BACKEND="memory")
|
||||
with pytest.raises(ValueError, match="NAMESPACE"):
|
||||
|
||||
Reference in New Issue
Block a user