Replace hardcoded volume size by created volume size
If the volumes_client is configured to use a volume_size different
from the hardcoded value "1", an error will be raised.
This patch replaces the hardcoded value by the actual size of the
created volume.
Closes-Bug: 1430375
Change-Id: Ie6593b5c60c697b62a65a38d37e4942e9e80cc10
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index cd91552..1120d8c 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -94,7 +94,8 @@
self.assertEqual(quota_usage['volumes']['in_use'] + 1,
new_quota_usage['volumes']['in_use'])
- self.assertEqual(quota_usage['gigabytes']['in_use'] + 1,
+ self.assertEqual(quota_usage['gigabytes']['in_use'] +
+ volume["size"],
new_quota_usage['gigabytes']['in_use'])
@test.attr(type='gate')
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index 98b7143..d7287f0 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.py
@@ -31,7 +31,9 @@
@classmethod
def resource_setup(cls):
super(BaseVolumeQuotasNegativeV2TestJSON, cls).resource_setup()
- cls.shared_quota_set = {'gigabytes': 3, 'volumes': 1, 'snapshots': 1}
+ cls.default_volume_size = cls.volumes_client.default_volume_size
+ cls.shared_quota_set = {'gigabytes': 3 * cls.default_volume_size,
+ 'volumes': 1, 'snapshots': 1}
# NOTE(gfidente): no need to restore original quota set
# after the tests as they only work with tenant isolation.
@@ -67,14 +69,16 @@
self.demo_tenant_id,
**self.shared_quota_set)
- new_quota_set = {'gigabytes': 2, 'volumes': 2, 'snapshots': 1}
+ new_quota_set = {'gigabytes': 2 * self.default_volume_size,
+ 'volumes': 2, 'snapshots': 1}
self.quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
self.assertRaises(lib_exc.OverLimit,
self.volumes_client.create_volume)
- new_quota_set = {'gigabytes': 2, 'volumes': 1, 'snapshots': 2}
+ new_quota_set = {'gigabytes': 2 * self.default_volume_size,
+ 'volumes': 1, 'snapshots': 2}
self.quotas_client.update_quota_set(
self.demo_tenant_id,
**self.shared_quota_set)