private static Task Behaviour(Context arg1, CancellationToken arg2) { throw new PostgresException { SqlState = ChaosPolicyShared.GetRandomString(RetryablePostGreErrors.Errors.ToList()) }; }
private static InjectBehaviourPolicy CreateRetryChaos(IPolicies policies) { return(MonkeyPolicy.InjectBehaviour( (context) => throw new PostgresException { SqlState = ChaosPolicyShared.GetRandomString(RetryablePostGreErrors.Errors.ToList()) }, (context) => ChaosPolicyShared.InjectionRate(context, RetryConstants.RetryCount, RetryAttempts), (context) => policies.EnableChaos)); }
private static AsyncInjectOutcomePolicy CreateRetryChaosAsync(IPolicies policies) { var fault = new PostgresException(string.Empty, string.Empty, string.Empty, ChaosPolicyShared.GetRandomString(RetryablePostGreErrors.Errors.ToList())); return(MonkeyPolicy.InjectExceptionAsync(with => with.Fault(fault) .InjectionRate((context, token) => ChaosPolicyShared.InjectionRateAsync(context, RetryConstants.RetryCount, RetryAttempts)) .Enabled(policies.EnableChaos) )); }