def destroy(self, context=None): """Delete the ComputeNode from the DB. :param context: Security context. """ dbapi.destroy_compute_node(context, self.uuid) self.obj_reset_changes(recursive=True)
def test_destroy_compute_node(self, mock_delete, mock_write, mock_read): mock_read.side_effect = etcd.EtcdKeyNotFound compute_node = utils.create_test_compute_node(context=self.context) mock_read.side_effect = lambda *args: FakeEtcdResult(compute_node. as_dict()) dbapi.destroy_compute_node(self.context, compute_node.uuid) mock_delete.assert_called_once_with('/compute_nodes/%s' % compute_node.uuid)
def test_destroy_compute_node_by_uuid(self): node = utils.create_test_compute_node(context=self.context) dbapi.destroy_compute_node(self.context, node.uuid) self.assertRaises(exception.ComputeNodeNotFound, dbapi.get_compute_node, self.context, node.uuid)