diff options
author | whoami-rajat <rajatdhasmana@gmail.com> | 2021-11-23 11:01:44 -0500 |
---|---|---|
committer | Rajat Dhasmana <rajatdhasmana@gmail.com> | 2022-08-09 14:21:14 +0000 |
commit | 20110a7d0c310eac81635d1f8c60bce423418820 (patch) | |
tree | be8ffebce6744979e3e1b15a3ebd1d155de12b05 | |
parent | b4091752b4a771a54b5298d15729352ae9552e81 (diff) | |
download | glance-20110a7d0c310eac81635d1f8c60bce423418820.tar.gz |
Fix tests for logging connection info
While logging connection info in the glance cinder store driver, we
need to mask passwords for which we use oslo_utils's mask_dict_password
method.
Since this is not mocked in the glance functional tests, we encounter a failure
in cross-glance-tox-functional job in the change[1].
This patch adds the required mocking to pass the tests.
[1] https://review.opendev.org/c/openstack/glance_store/+/818722
Change-Id: Ibd9563fb854f888b4a2f5a5dcf6abce0cfab0f04
(cherry picked from commit acc6f624cdb1b2e4a3900e7d226bbc5156e8fa17)
-rw-r--r-- | glance/tests/functional/v2/test_legacy_update_cinder_store.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/glance/tests/functional/v2/test_legacy_update_cinder_store.py b/glance/tests/functional/v2/test_legacy_update_cinder_store.py index c99ea6bb4..fa86b28b6 100644 --- a/glance/tests/functional/v2/test_legacy_update_cinder_store.py +++ b/glance/tests/functional/v2/test_legacy_update_cinder_store.py @@ -21,6 +21,7 @@ import glance_store from glance_store._drivers import cinder from oslo_config import cfg from oslo_log import log as logging +from oslo_utils import strutils from glance.common import wsgi from glance.tests import functional @@ -136,8 +137,9 @@ class TestLegacyUpdateCinderStore(functional.SynchronousAPIBase): @mock.patch.object(cinder, 'connector') @mock.patch.object(cinder, 'open') @mock.patch('glance_store._drivers.cinder.Store._wait_volume_status') - def test_create_image(self, mock_wait, mock_open, mock_connector, - mock_chown, mocked_cc): + @mock.patch.object(strutils, 'mask_dict_password') + def test_create_image(self, mock_mask_pass, mock_wait, mock_open, + mock_connector, mock_chown, mocked_cc): # setup multiple cinder stores self.setup_multiple_stores() self.start_server() @@ -163,9 +165,10 @@ class TestLegacyUpdateCinderStore(functional.SynchronousAPIBase): @mock.patch.object(cinder, 'connector') @mock.patch.object(cinder, 'open') @mock.patch('glance_store._drivers.cinder.Store._wait_volume_status') - def test_migrate_image_after_upgrade(self, mock_wait, mock_open, - mock_connector, mock_chown, - mocked_cc): + @mock.patch.object(strutils, 'mask_dict_password') + def test_migrate_image_after_upgrade(self, mock_mask_pass, mock_wait, + mock_open, mock_connector, + mock_chown, mocked_cc): """Test to check if an image is successfully migrated when we upgrade from a single cinder store to multiple cinder stores. @@ -208,9 +211,11 @@ class TestLegacyUpdateCinderStore(functional.SynchronousAPIBase): @mock.patch.object(cinder, 'connector') @mock.patch.object(cinder, 'open') @mock.patch('glance_store._drivers.cinder.Store._wait_volume_status') - def test_migrate_image_after_upgrade_not_owner(self, mock_wait, mock_open, - mock_connector, mock_chown, - mocked_cc): + @mock.patch.object(strutils, 'mask_dict_password') + def test_migrate_image_after_upgrade_not_owner(self, mock_mask_pass, + mock_wait, mock_open, + mock_connector, + mock_chown, mocked_cc): """Test to check if an image is successfully migrated when we upgrade from a single cinder store to multiple cinder stores, and that GETs from non-owners in the meantime are not interrupted. |