Ejemplo n.º 1
0
 def test_status_updates(self):
     hosts = [0, 1, 2, 3]
     policy = RoundRobinPolicy()
     policy.populate(None, hosts)
     policy.on_down(0)
     policy.on_remove(1)
     policy.on_up(4)
     policy.on_add(5)
     qplan = list(policy.make_query_plan())
     self.assertEqual(sorted(qplan), [2, 3, 4, 5])
Ejemplo n.º 2
0
    def test_no_live_nodes(self):
        hosts = [0, 1, 2, 3]
        policy = RoundRobinPolicy()
        policy.populate(None, hosts)

        for i in range(4):
            policy.on_down(i)

        query_plan = list(policy.make_query_plan())
        self.assertEqual(query_plan, [])
Ejemplo n.º 3
0
    def test_no_live_nodes(self):
        """
        Ensure query plan for a downed cluster will execute without errors
        """
        hosts = [0, 1, 2, 3]
        policy = RoundRobinPolicy()
        policy.populate(None, hosts)

        for i in range(4):
            policy.on_down(i)

        qplan = list(policy.make_query_plan())
        self.assertEqual(qplan, [])