def test_loadbalancer_is_using_simple_hashing_algorithm(): # N.B.: relyaing on the fact that hash(n) == n for integers eq_(0, load_balancer.select(0, [0,1,2])) eq_(1, load_balancer.select(1, [0,1,2])) eq_(2, load_balancer.select(2, [0,1,2])) eq_(0, load_balancer.select(3, [0,1,2]))
def send_event(self, e): addr = load_balancer.select(e, self.l) self.s.sendto(e.serialize(), 0, addr)