summaryrefslogtreecommitdiff
path: root/ironic/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-11-04 14:40:47 +0000
committerGerrit Code Review <review@openstack.org>2022-11-04 14:40:47 +0000
commit06975d726e1eba50afd0c51c2e797ba6dca5e335 (patch)
tree213dc855c7cd348ba876c90f4a9e566a096ff06a /ironic/tests
parent5c01f7f7b45f976aa0c8a23369e68cd5b39f745e (diff)
parentcab51a9fcc022f2e4bb634277dd20e90e2dc78f7 (diff)
downloadironic-06975d726e1eba50afd0c51c2e797ba6dca5e335.tar.gz
Merge "Fix the invalid glance client test"
Diffstat (limited to 'ironic/tests')
-rw-r--r--ironic/tests/unit/common/test_glance_service.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/ironic/tests/unit/common/test_glance_service.py b/ironic/tests/unit/common/test_glance_service.py
index 327125a81..f9e713e91 100644
--- a/ironic/tests/unit/common/test_glance_service.py
+++ b/ironic/tests/unit/common/test_glance_service.py
@@ -24,7 +24,6 @@ from glanceclient import exc as glance_exc
from keystoneauth1 import loading as ks_loading
from oslo_config import cfg
from oslo_utils import uuidutils
-import tenacity
import testtools
from ironic.common import context
@@ -202,20 +201,18 @@ class TestGlanceImageService(base.TestCase):
image_id = uuidutils.generate_uuid()
writer = NullWriter()
- with mock.patch.object(tenacity, 'retry', autospec=True) as mock_retry:
- # When retries are disabled, we should get an exception
- self.config(num_retries=0, group='glance')
- self.assertRaises(exception.GlanceConnectionFailed,
- stub_service.download, image_id, writer)
-
- # Now lets enable retries. No exception should happen now.
- self.config(num_retries=1, group='glance')
- importlib.reload(image_service)
- stub_service = image_service.GlanceImageService(stub_client,
- stub_context)
- tries = [0]
- stub_service.download(image_id, writer)
- mock_retry.assert_called_once()
+ # When retries are disabled, we should get an exception
+ self.config(num_retries=0, group='glance')
+ self.assertRaises(exception.GlanceConnectionFailed,
+ stub_service.download, image_id, writer)
+
+ # Now lets enable retries. No exception should happen now.
+ self.config(num_retries=1, group='glance')
+ importlib.reload(image_service)
+ stub_service = image_service.GlanceImageService(stub_client,
+ stub_context)
+ tries = [0]
+ stub_service.download(image_id, writer)
def test_download_no_data(self):
self.client.fake_wrapped = None