def test_linear_retry_interval(self, resource_group, location, storage_account, storage_account_key): # Arrange context_stub = {} for i in range(10): # Act retry_policy = LinearRetry(backoff=1, random_jitter_range=3) backoff = retry_policy.get_backoff_time(context_stub) # Assert backoff interval is within +/- 3 of 1 self.assertTrue(0 <= backoff <= 4) # Act retry_policy = LinearRetry(backoff=5, random_jitter_range=3) backoff = retry_policy.get_backoff_time(context_stub) # Assert backoff interval is within +/- 3 of 5 self.assertTrue(2 <= backoff <= 8) # Act retry_policy = LinearRetry(backoff=15, random_jitter_range=3) backoff = retry_policy.get_backoff_time(context_stub) # Assert backoff interval is within +/- 3 of 15 self.assertTrue(12 <= backoff <= 18)
def test_linear_retry_interval(self): # Arrange context_stub = {} for i in range(10): # Act retry_policy = LinearRetry(backoff=1, random_jitter_range=3) backoff = retry_policy.get_backoff_time(context_stub) # Assert backoff interval is within +/- 3 of 1 self.assertTrue(0 <= backoff <= 4) # Act retry_policy = LinearRetry(backoff=5, random_jitter_range=3) backoff = retry_policy.get_backoff_time(context_stub) # Assert backoff interval is within +/- 3 of 5 self.assertTrue(2 <= backoff <= 8) # Act retry_policy = LinearRetry(backoff=15, random_jitter_range=3) backoff = retry_policy.get_backoff_time(context_stub) # Assert backoff interval is within +/- 3 of 15 self.assertTrue(12 <= backoff <= 18)