Esempio n. 1
0
    def test_remove_nodes_from_host_different_groups(self):
        another_group = 'another_test_group'
        group1 = self._add_nodes_and_assert_exists(count=3)
        group2 = self._add_nodes_and_assert_exists(count=2,
                                                   group_name=another_group)

        ovn_hash_ring_db.remove_nodes_from_host(self.admin_ctx,
                                                HASH_RING_TEST_GROUP)
        # Assert that all nodes from that group have been removed
        for node in group1:
            self.assertIsNone(self._get_node_row(node))

        # Assert that all nodes from a different group are intact
        for node in group2:
            self.assertIsNotNone(self._get_node_row(node))
Esempio n. 2
0
    def test_remove_nodes_from_host(self):
        nodes = self._add_nodes_and_assert_exists(count=3)

        # Add another node from a different host
        with mock.patch.object(ovn_hash_ring_db, 'CONF') as mock_conf:
            mock_conf.host = 'another-host-' + uuidutils.generate_uuid()
            another_host_node = self._add_nodes_and_assert_exists()[0]

        ovn_hash_ring_db.remove_nodes_from_host(self.admin_ctx,
                                                HASH_RING_TEST_GROUP)
        # Assert that all nodes from that host have been removed
        for n in nodes:
            self.assertIsNone(self._get_node_row(n))

        # Assert that the node from another host wasn't removed
        self.assertIsNotNone(self._get_node_row(another_host_node))