summaryrefslogtreecommitdiff
path: root/nova/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-11-09 23:51:46 +0000
committerGerrit Code Review <review@openstack.org>2020-11-09 23:51:46 +0000
commitdc93e3b510f53d5b2198c8edd22528f0c899617e (patch)
treed1727dc08e472089202d6a4b0d74e57abc0f335c /nova/tests
parent4f2540a7a69d52390011adb1e74b20f0f1333361 (diff)
parent4916ab7a4cb67edc0b54a8ee67c58b1302769792 (diff)
downloadnova-dc93e3b510f53d5b2198c8edd22528f0c899617e.tar.gz
Merge "rbd: Only log import failures when the RbdDriver is used"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/unit/image/test_glance.py12
-rw-r--r--nova/tests/unit/virt/libvirt/test_driver.py6
2 files changed, 12 insertions, 6 deletions
diff --git a/nova/tests/unit/image/test_glance.py b/nova/tests/unit/image/test_glance.py
index 89920759dc..5de409bfca 100644
--- a/nova/tests/unit/image/test_glance.py
+++ b/nova/tests/unit/image/test_glance.py
@@ -1337,9 +1337,11 @@ class TestRBDDownload(test.NoDBTestCase):
self.pool_name = "images"
self.snapshot_name = "snap"
+ @mock.patch('nova.storage.rbd_utils.RBDDriver._check_for_import_failure',
+ new=mock.Mock())
@mock.patch.object(rbd_utils.RBDDriver, 'export_image')
- @mock.patch.object(rbd_utils, 'rbd')
- def test_rbd_download_success(self, mock_rbd, mock_export_image):
+ @mock.patch.object(rbd_utils, 'rbd', new=mock.Mock())
+ def test_rbd_download_success(self, mock_export_image):
client = mock.MagicMock()
ctx = mock.sentinel.ctx
service = glance.GlanceImageServiceV2(client)
@@ -1366,9 +1368,11 @@ class TestRBDDownload(test.NoDBTestCase):
exception.InvalidParameterValue, service.rbd_download, ctx,
wrong_url_parts, mock.sentinel.dst_path)
+ @mock.patch('nova.storage.rbd_utils.RBDDriver._check_for_import_failure',
+ new=mock.Mock())
@mock.patch('nova.storage.rbd_utils.RBDDriver.export_image')
- @mock.patch.object(rbd_utils, 'rbd')
- def test_rbd_download_export_failure(self, mock_rbd, mock_export_image):
+ @mock.patch.object(rbd_utils, 'rbd', new=mock.Mock())
+ def test_rbd_download_export_failure(self, mock_export_image):
client = mock.MagicMock()
ctx = mock.sentinel.ctx
service = glance.GlanceImageServiceV2(client)
diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py
index 903ae889c8..f6a649002f 100644
--- a/nova/tests/unit/virt/libvirt/test_driver.py
+++ b/nova/tests/unit/virt/libvirt/test_driver.py
@@ -5350,10 +5350,12 @@ class LibvirtConnTestCase(test.NoDBTestCase,
def test_get_guest_config_default_with_virtio_scsi_bus(self):
self._test_get_guest_config_with_virtio_scsi_bus()
+ @mock.patch.object(rbd_utils.RBDDriver, '_check_for_import_failure',
+ new=mock.Mock())
@mock.patch.object(rbd_utils.RBDDriver, 'get_mon_addrs')
- @mock.patch.object(rbd_utils, 'rbd')
+ @mock.patch.object(rbd_utils, 'rbd', new=mock.Mock())
def test_get_guest_config_rbd_with_virtio_scsi_bus(
- self, mock_rdb, mock_get_mon_addrs):
+ self, mock_get_mon_addrs):
self.flags(images_type='rbd', group='libvirt')
mock_get_mon_addrs.return_value = ("host", 9876)
self._test_get_guest_config_with_virtio_scsi_bus()