public void TestAndRetryCondition() { var retryPolicyContext = new RetryPolicyContext(null, "200", 2, "ecs", "2014-05-26", "DescribeInstances", RetryCondition.BlankStatus); var retryOnApiCondition = new RetryOnApiCondition(); var orList = new List <IAlibabaRetryCondition> { retryOnApiCondition }; var orRetryCondition = new OrRetryCondition(orList); var maxRetryTimesCondition = new MaxRetryTimesCondition(3); var andList = new List <IAlibabaRetryCondition> { orRetryCondition, maxRetryTimesCondition }; var andRetryCondition = new AndRetryCondition(andList); var shouldRetry = andRetryCondition.ShouldRetry(retryPolicyContext); Assert.Equal(RetryCondition.ShouldRetry, shouldRetry); }
public void TestMaxRetryTimes() { var retryPolicyContext = new RetryPolicyContext(null, "200", 0, "ecs", "2019-06-01", "DescribeInstances", RetryCondition.BlankStatus); var maxRetryTimesCondition = new MaxRetryTimesCondition(maxRetryTimes); var shouldRetry = maxRetryTimesCondition.ShouldRetry(retryPolicyContext); Assert.Equal(RetryCondition.ShouldRetry, shouldRetry); shouldRetry = maxRetryTimesCondition.ShouldRetry(retryPolicyContext); Assert.Equal(RetryCondition.NoRetry, shouldRetry); }