summaryrefslogtreecommitdiff
path: root/glance_store/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-05-05 13:34:26 +0000
committerGerrit Code Review <review@openstack.org>2022-05-05 13:34:26 +0000
commit111a7a14b0bca5bfb0c2d07439c2c0fa82821656 (patch)
treea964e89475af4ccc911a80cf7710eb5191d2babc /glance_store/tests
parent3b948892d762b78b909e9be4af0a9dbf6f6cbb66 (diff)
parent3ee399a1e35fbf9067f0548b69bc19ca48b8de5f (diff)
downloadglance_store-111a7a14b0bca5bfb0c2d07439c2c0fa82821656.tar.gz
Merge "Cinder: Correct exception logging during attach"
Diffstat (limited to 'glance_store/tests')
-rw-r--r--glance_store/tests/unit/common/test_attachment_state_manager.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/glance_store/tests/unit/common/test_attachment_state_manager.py b/glance_store/tests/unit/common/test_attachment_state_manager.py
index f019c9b..d8c5189 100644
--- a/glance_store/tests/unit/common/test_attachment_state_manager.py
+++ b/glance_store/tests/unit/common/test_attachment_state_manager.py
@@ -18,6 +18,7 @@ from unittest import mock
from oslo_config import cfg
from oslotest import base
+from cinderclient import exceptions as cinder_exception
from glance_store.common import attachment_state_manager as attach_manager
from glance_store.common import cinder_utils
from glance_store import exceptions
@@ -106,3 +107,11 @@ class AttachmentStateTestCase(base.BaseTestCase):
*self.disconnect_vol_call)
mock_attach_delete.assert_called_once_with(
*self.detach_call)
+
+ @mock.patch.object(cinder_utils.API, 'attachment_create')
+ def test_attach_fails(self, mock_attach_create):
+ mock_attach_create.side_effect = cinder_exception.BadRequest(code=400)
+ self.assertRaises(
+ cinder_exception.BadRequest, self.m.attach,
+ mock.sentinel.client, mock.sentinel.volume_id,
+ mock.sentinel.host, mode=mock.sentinel.mode)