diff options
author | Zuul <zuul@review.opendev.org> | 2021-08-16 17:08:25 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-08-16 17:08:25 +0000 |
commit | 4598766890783c61a34677a3d88c0341a9d6ea8b (patch) | |
tree | b962918d1d3315f016b0157c27a3904fb4c45189 /glance_store/tests | |
parent | b42ffa40351b31fc93196b34932bb36056ff33db (diff) | |
parent | 6a241a20c9c17ede1985e5c1f4c63fcaf2a2dbc7 (diff) | |
download | glance_store-4598766890783c61a34677a3d88c0341a9d6ea8b.tar.gz |
Merge "Raise correct exception from "Quota full""
Diffstat (limited to 'glance_store/tests')
-rw-r--r-- | glance_store/tests/unit/test_swift_store.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/glance_store/tests/unit/test_swift_store.py b/glance_store/tests/unit/test_swift_store.py index 6b5d659..7364923 100644 --- a/glance_store/tests/unit/test_swift_store.py +++ b/glance_store/tests/unit/test_swift_store.py @@ -479,6 +479,33 @@ class SwiftTests(object): expected_image_id, image_swift, expected_swift_size, HASH_ALGO) self.assertEqual(expected_location, location) + def test_add_raises_storage_full(self): + + conf = copy.deepcopy(SWIFT_CONF) + conf['default_swift_reference'] = 'store_2' + self.config(**conf) + moves.reload_module(swift) + self.mock_keystone_client() + self.store = Store(self.conf) + self.store.configure() + + def fake_put_object_entity_too_large(*args, **kwargs): + msg = "Test Out of Quota" + raise swiftclient.ClientException( + msg, http_status=http_client.REQUEST_ENTITY_TOO_LARGE) + + self.useFixture(fixtures.MockPatch( + 'swiftclient.client.put_object', fake_put_object_entity_too_large)) + + expected_swift_size = FIVE_KB + expected_swift_contents = b"*" * expected_swift_size + expected_image_id = str(uuid.uuid4()) + image_swift = six.BytesIO(expected_swift_contents) + + self.assertRaises(exceptions.StorageFull, self.store.add, + expected_image_id, image_swift, + expected_swift_size, HASH_ALGO) + @mock.patch('glance_store._drivers.swift.utils' '.is_multiple_swift_store_accounts_enabled', mock.Mock(return_value=False)) |