Exemplo n.º 1
0
    def test_deletion_task_called(self, mdeletion_execute):
        cluster = self.env.create_cluster()
        cluster_id = cluster['id']
        node_db = self.env.create_node(
            api=False,
            cluster_id=cluster['id'],
            pending_addition=False,
            pending_deletion=True,
            status=NODE_STATUSES.ready,
            roles=['controller'])

        manager_ = manager.ApplyChangesTaskManager(cluster_id)
        manager_.execute()

        self.assertEqual(mdeletion_execute.call_count, 1)
        task, nodes = mdeletion_execute.call_args[0]
        # unfortunately assertItemsEqual does not recurse into dicts
        self.assertItemsEqual(
            nodes['nodes_to_delete'],
            DeletionTask.prepare_nodes_for_task([node_db])['nodes_to_delete']
        )
        self.assertItemsEqual(
            nodes['nodes_to_restore'],
            DeletionTask.prepare_nodes_for_task([node_db])['nodes_to_restore']
        )
Exemplo n.º 2
0
    def test_deletion_task_called(self, mdeletion_execute):
        cluster = self.env.create_cluster()
        cluster_id = cluster['id']
        node_db = self.env.create_node(api=False,
                                       cluster_id=cluster['id'],
                                       pending_addition=False,
                                       pending_deletion=True,
                                       status=NODE_STATUSES.ready,
                                       roles=['controller'])

        manager_ = manager.ApplyChangesTaskManager(cluster_id)
        manager_.execute()

        self.assertEqual(mdeletion_execute.call_count, 1)
        task, nodes = mdeletion_execute.call_args[0]
        # unfortunately assertItemsEqual does not recurse into dicts
        self.assertItemsEqual(
            nodes['nodes_to_delete'],
            DeletionTask.prepare_nodes_for_task([node_db])['nodes_to_delete'])
        self.assertItemsEqual(
            nodes['nodes_to_restore'],
            DeletionTask.prepare_nodes_for_task([node_db])['nodes_to_restore'])