예제 #1
0
 private static Task Behaviour(Context arg1, CancellationToken arg2)
 {
     throw new PostgresException
           {
               SqlState = ChaosPolicyShared.GetRandomString(RetryablePostGreErrors.Errors.ToList())
           };
 }
예제 #2
0
 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));
 }
예제 #3
0
        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)
                                                     ));
        }