Пример #1
0
    def test_full_jitter(self):
        retries = 5
        seed = 1

        r = random.Random(seed)
        expected = [r.randint(0, 2**i) for i in range(0, retries)]

        strategy = _full_jitter_backoff(
            retries=retries, delay=1, _random=random.Random(seed))
        result = list(strategy())

        self.assertEquals(result, expected)
Пример #2
0
    def test_full_jitter(self):
        retries = 5
        seed = 1

        r = random.Random(seed)
        expected = [r.randint(0, 2**i) for i in range(0, retries)]

        strategy = _full_jitter_backoff(
            retries=retries, delay=1, _random=random.Random(seed))
        result = list(strategy())

        self.assertEquals(result, expected)
Пример #3
0
 def test_no_retries(self):
     strategy = _full_jitter_backoff(retries=0)
     result = list(strategy())
     self.assertEqual(result, [], 'list should be empty')
Пример #4
0
 def test_no_retries(self):
     strategy = _full_jitter_backoff(retries=0)
     result = list(strategy())
     self.assertEquals(result, [], 'list should be empty')