Skip to content

Commit f64ccc4

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Reproducer unit test for bug 1860312" into stable/wallaby
2 parents 4cdb2b3 + e6cd23c commit f64ccc4

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
@@ -700,6 +700,25 @@ def test_services_delete(self, mock_get_compute_nodes):
700700
mock_get_compute_nodes.assert_called_once_with(
701701
self.req.environ['nova.context'], compute.host)
702702

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

705724
self.assertRaises(webob.exc.HTTPNotFound,

0 commit comments

Comments
 (0)