Package org.mockserver.mock.action.http
Class GrpcChaosDecision
java.lang.Object
org.mockserver.mock.action.http.GrpcChaosDecision
Evaluates a
GrpcChaosProfile against the current request context
(match count, quota state) and decides whether to inject a gRPC fault.
Returns either null (no fault, pass through to normal handling) or
a GrpcChaosDecision.GrpcFault describing the gRPC status code and message to inject.
Decision priority:
- Count window: if the match count is outside the eligible window, no fault is injected.
- Quota: if quota fields are configured and the limit is exceeded, RESOURCE_EXHAUSTED is returned deterministically.
- Probability: if a seeded/unseeded random draw is below
errorProbability, the configured (or default UNAVAILABLE) error status is returned.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe outcome of a gRPC chaos fault decision. -
Method Summary
Modifier and TypeMethodDescriptionstatic GrpcChaosDecision.GrpcFaultevaluate(GrpcChaosProfile profile, int matchCount, HttpQuotaRegistry quotaRegistry) Evaluate the given profile and decide whether to inject a gRPC fault.
-
Method Details
-
evaluate
public static GrpcChaosDecision.GrpcFault evaluate(GrpcChaosProfile profile, int matchCount, HttpQuotaRegistry quotaRegistry) Evaluate the given profile and decide whether to inject a gRPC fault.- Parameters:
profile- the gRPC chaos profile (must not be null)matchCount- 1-based per-service match countquotaRegistry- the quota registry for deterministic rate limiting (may be null for no-quota scenarios)- Returns:
- a
GrpcChaosDecision.GrpcFaultto inject, ornullif no fault should be injected
-