def test_random_lb_with_members(self): cluster = _MockClusterService([0, 1, 2]) lb = RandomLB() lb.init(cluster) for _ in range(10): self.assertTrue(0 <= lb.next() <= 2)
def test_random_lb_with_no_members(self): cluster = _MockClusterService([]) lb = RandomLB() lb.init(cluster) self.assertIsNone(lb.next())