Adding test_max_image_meta_exceed_limit
A negative test which verifies that server creation
with exceeding of absolute limit maxImageMeta is impossible
Change-Id: Iac3604fcb12a77a41cf822eeee2b9cd0ce2a0178
diff --git a/tempest/tests/compute/limits/test_absolute_limits.py b/tempest/tests/compute/limits/test_absolute_limits.py
index 2b31680..6933fd7 100644
--- a/tempest/tests/compute/limits/test_absolute_limits.py
+++ b/tempest/tests/compute/limits/test_absolute_limits.py
@@ -15,6 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest import exceptions
+from tempest.test import attr
from tempest.tests.compute import base
@@ -25,6 +27,7 @@
def setUpClass(cls):
super(AbsoluteLimitsTestJSON, cls).setUpClass()
cls.client = cls.limits_client
+ cls.server_client = cls.servers_client
def test_absLimits_get(self):
# To check if all limits are present in the response
@@ -45,6 +48,24 @@
"Failed to find element %s in absolute limits list"
% ', '.join(ele for ele in missing_elements))
+ @attr(type='negative')
+ def test_max_image_meta_exceed_limit(self):
+ #We should not create vm with image meta over maxImageMeta limit
+ # Get max limit value
+ max_meta = self.client.get_specific_absolute_limit('maxImageMeta')
+
+ #Create server should fail, since we are passing > metadata Limit!
+ max_meta_data = int(max_meta) + 1
+
+ meta_data = {}
+ for xx in range(max_meta_data):
+ meta_data[str(xx)] = str(xx)
+
+ self.assertRaises(exceptions.OverLimit,
+ self.server_client.create_server,
+ name='test', meta=meta_data, flavor_ref='84',
+ image_ref='9e6a2e3b-1601-42a5-985f-c3a2f93a5ec3')
+
class AbsoluteLimitsTestXML(AbsoluteLimitsTestJSON):
_interface = 'xml'