Skip to content

Commit 66ccea7

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Reproducer unit test for bug 1860312" into stable/victoria
2 parents 14277ac + 9efdd0b commit 66ccea7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

nova/tests/unit/api/openstack/compute/test_services.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,25 @@ def test_services_delete(self, mock_get_compute_nodes):
701701
mock_get_compute_nodes.assert_called_once_with(
702702
self.req.environ['nova.context'], compute.host)
703703

704+
@mock.patch(
705+
'nova.objects.ComputeNodeList.get_all_by_host',
706+
side_effect=exception.ComputeHostNotFound(host='fake-compute-host'))
707+
def test_services_delete_compute_host_not_found(
708+
self, mock_get_all_by_host):
709+
compute = objects.Service(self.ctxt,
710+
**{'host': 'fake-compute-host',
711+
'binary': 'nova-compute',
712+
'topic': 'compute',
713+
'report_count': 0})
714+
compute.create()
715+
# FIXME(artom) Until bug 1860312 is fixed, the ComputeHostNotFound
716+
# error will get bubbled up to the API as an error 500.
717+
self.assertRaises(
718+
webob.exc.HTTPInternalServerError,
719+
self.controller.delete, self.req, compute.id)
720+
mock_get_all_by_host.assert_called_with(
721+
self.req.environ['nova.context'], 'fake-compute-host')
722+
704723
def test_services_delete_not_found(self):
705724

706725
self.assertRaises(webob.exc.HTTPNotFound,

0 commit comments

Comments
 (0)