Policy Application¶
Typical flow¶
Register policy with
register_policy.Apply directly with
fault("name")or indirectly withfault("auto")+policy_context.Assert behavior in HTTP/TCP/UDP client tests.
Minimal integration example¶
import faultcore
faultcore.register_policy(name="client_degraded", timeout={"connect": "250ms", "recv": "900ms"}, packet_loss="1%")
@faultcore.fault("client_degraded")
def call_service() -> str:
return "ok"
def test_http_client_policy_profile() -> None:
assert call_service() == "ok"
Common errors¶
Using
fault("auto")without setting thread policy.Defining policy names inconsistently across test suite.