diff options
author | Zuul <zuul@review.opendev.org> | 2021-09-01 13:42:07 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-09-01 13:42:07 +0000 |
commit | 66ccea7562470098eb2abe42ec8ddc9fc86f0bf2 (patch) | |
tree | a5aaf332dd610a9d8e19241fdaabbcd05a869924 | |
parent | 14277ac022741cb685544f15a96bd31a31a6ad3c (diff) | |
parent | 9efdd0b085733a0a4c4192aab8fc870c8aadf316 (diff) | |
download | nova-66ccea7562470098eb2abe42ec8ddc9fc86f0bf2.tar.gz |
Merge "Reproducer unit test for bug 1860312" into stable/victoria
-rw-r--r-- | nova/tests/unit/api/openstack/compute/test_services.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nova/tests/unit/api/openstack/compute/test_services.py b/nova/tests/unit/api/openstack/compute/test_services.py index 170b39f208..07acbaab16 100644 --- a/nova/tests/unit/api/openstack/compute/test_services.py +++ b/nova/tests/unit/api/openstack/compute/test_services.py @@ -701,6 +701,25 @@ class ServicesTestV21(test.TestCase): mock_get_compute_nodes.assert_called_once_with( self.req.environ['nova.context'], compute.host) + @mock.patch( + 'nova.objects.ComputeNodeList.get_all_by_host', + side_effect=exception.ComputeHostNotFound(host='fake-compute-host')) + def test_services_delete_compute_host_not_found( + self, mock_get_all_by_host): + compute = objects.Service(self.ctxt, + **{'host': 'fake-compute-host', + 'binary': 'nova-compute', + 'topic': 'compute', + 'report_count': 0}) + compute.create() + # FIXME(artom) Until bug 1860312 is fixed, the ComputeHostNotFound + # error will get bubbled up to the API as an error 500. + self.assertRaises( + webob.exc.HTTPInternalServerError, + self.controller.delete, self.req, compute.id) + mock_get_all_by_host.assert_called_with( + self.req.environ['nova.context'], 'fake-compute-host') + def test_services_delete_not_found(self): self.assertRaises(webob.exc.HTTPNotFound, |