Exemple #1
0
 def test_add_host(self):
     h1 = Host('x', 'x.me.com')
     h2 = Host('y', 'y.me.com')
     conf = {'LB_ID': 'explode'}
     lb = LoadBalancer.create('fake', 'my-lb', conf)
     lb.add_host(h1)
     lb.add_host(h2)
     self.assertItemsEqual(lb.hosts, [h1, h2])
     db_lb = LoadBalancer.find('my-lb', conf)
     self.assertEqual(db_lb.hosts[0].config, conf)
     self.assertEqual(db_lb.hosts[1].config, conf)
     self.assertItemsEqual([h.to_json() for h in db_lb.hosts], [h1.to_json(), h2.to_json()])
Exemple #2
0
 def test_add_host(self):
     h1 = Host('x', 'x.me.com')
     h2 = Host('y', 'y.me.com')
     conf = {'LB_ID': 'explode'}
     lb = LoadBalancer.create('fake', 'my-lb', conf)
     lb.add_host(h1)
     lb.add_host(h2)
     self.assertItemsEqual(lb.hosts, [h1, h2])
     db_lb = LoadBalancer.find('my-lb', conf)
     self.assertEqual(db_lb.hosts[0].config, conf)
     self.assertEqual(db_lb.hosts[1].config, conf)
     self.assertItemsEqual([h.to_json() for h in db_lb.hosts],
                           [h1.to_json(), h2.to_json()])
Exemple #3
0
 def test_remove_host(self):
     h1 = Host('x', 'x.me.com')
     h2 = Host('y', 'y.me.com')
     lb = LoadBalancer.create('fake', 'my-lb', {'LB_ID': 'explode'})
     lb.add_host(h1)
     lb.add_host(h2)
     lb.remove_host(h1)
     self.assertItemsEqual(lb.hosts, [h2])
     db_lb = LoadBalancer.find('my-lb')
     self.assertItemsEqual([h.to_json() for h in db_lb.hosts], [h2.to_json()])
Exemple #4
0
 def test_remove_host(self):
     h1 = Host('x', 'x.me.com')
     h2 = Host('y', 'y.me.com')
     lb = LoadBalancer.create('fake', 'my-lb', {'LB_ID': 'explode'})
     lb.add_host(h1)
     lb.add_host(h2)
     lb.remove_host(h1)
     self.assertItemsEqual(lb.hosts, [h2])
     db_lb = LoadBalancer.find('my-lb')
     self.assertItemsEqual([h.to_json() for h in db_lb.hosts],
                           [h2.to_json()])