Merge "add support for ceilometermiddleware data"
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 48201ec..e73ad1d 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -119,13 +119,10 @@
                        summary=False):
         self.assertIsNotNone(trust['id'])
         self.assertEqual(impersonate, trust['impersonation'])
-        # FIXME(shardy): ref bug #1246383 we can't check the
-        # microsecond component of the expiry time, because mysql
-        # <5.6.4 doesn't support microseconds.
-        # expected format 2013-12-20T16:08:36.036987Z
         if expires is not None:
-            expires_nousec = re.sub(r'\.([0-9]){6}Z', '', expires)
-            self.assertTrue(trust['expires_at'].startswith(expires_nousec))
+            # Omit microseconds of the expiry time
+            trust_expires_at = re.sub(r'\.([0-9]){6}', '', trust['expires_at'])
+            self.assertEqual(expires, trust_expires_at)
         else:
             self.assertIsNone(trust['expires_at'])
         self.assertEqual(self.trustor_user_id, trust['trustor_user_id'])
@@ -219,7 +216,13 @@
         # Test case to check we can create, get and delete a trust
         # with an expiry specified
         expires_at = timeutils.utcnow() + datetime.timedelta(hours=1)
-        expires_str = timeutils.isotime(at=expires_at, subsecond=True)
+        # NOTE(ylobankov) In some cases the expiry time may be rounded up
+        # because of microseconds. For example, we have the following expiry
+        # time for a trust: 2015-02-17T17:34:01.907051Z. However, if we make
+        # a GET request on the trust, the response may contain the time
+        # rounded up to 2015-02-17T17:34:02.000000Z. That is why we should
+        # omit microseconds when creating a trust.
+        expires_str = timeutils.isotime(at=expires_at)
 
         trust = self.create_trust(expires=expires_str)
         self.validate_trust(trust, expires=expires_str)
diff --git a/tempest/api_schema/response/compute/baremetal_nodes.py b/tempest/api_schema/response/compute/baremetal_nodes.py
index 2f67d37..e82792c 100644
--- a/tempest/api_schema/response/compute/baremetal_nodes.py
+++ b/tempest/api_schema/response/compute/baremetal_nodes.py
@@ -19,9 +19,9 @@
         'interfaces': {'type': 'array'},
         'host': {'type': 'string'},
         'task_state': {'type': ['string', 'null']},
-        'cpus': {'type': 'integer'},
-        'memory_mb': {'type': 'integer'},
-        'disk_gb': {'type': 'integer'},
+        'cpus': {'type': ['integer', 'string']},
+        'memory_mb': {'type': ['integer', 'string']},
+        'disk_gb': {'type': ['integer', 'string']},
     },
     'required': ['id', 'interfaces', 'host', 'task_state', 'cpus', 'memory_mb',
                  'disk_gb']
diff --git a/tempest/api_schema/response/compute/hypervisors.py b/tempest/api_schema/response/compute/hypervisors.py
index e9e1bc9..273b579 100644
--- a/tempest/api_schema/response/compute/hypervisors.py
+++ b/tempest/api_schema/response/compute/hypervisors.py
@@ -160,9 +160,14 @@
                 'items': {
                     'type': 'object',
                     'properties': {
+                        'status': {'type': 'string'},
+                        'state': {'type': 'string'},
                         'id': {'type': ['integer', 'string']},
                         'hypervisor_hostname': {'type': 'string'}
                     },
+                    # NOTE: When loading os-hypervisor-status extension,
+                    # a response contains status and state. So these params
+                    # should not be required.
                     'required': ['id', 'hypervisor_hostname']
                 }
             }
diff --git a/tempest/api_schema/response/compute/quotas.py b/tempest/api_schema/response/compute/quotas.py
index f49771e..863104c 100644
--- a/tempest/api_schema/response/compute/quotas.py
+++ b/tempest/api_schema/response/compute/quotas.py
@@ -28,8 +28,13 @@
                     'metadata_items': {'type': 'integer'},
                     'key_pairs': {'type': 'integer'},
                     'security_groups': {'type': 'integer'},
-                    'security_group_rules': {'type': 'integer'}
+                    'security_group_rules': {'type': 'integer'},
+                    'server_group_members': {'type': 'integer'},
+                    'server_groups': {'type': 'integer'},
                 },
+                # NOTE: server_group_members and server_groups are represented
+                # when enabling quota_server_group extension. So they should
+                # not be required.
                 'required': ['instances', 'cores', 'ram',
                              'floating_ips', 'fixed_ips',
                              'metadata_items', 'key_pairs',
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index 8949609..fde05af 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -79,7 +79,7 @@
         self.response = response
 
     def __str__(self):
-        body = super.__str__(self)
+        body = super(ResponseBody, self).__str__()
         return "response: %s\nBody: %s" % (self.response, body)
 
 
@@ -108,5 +108,5 @@
         self.response = response
 
     def __str__(self):
-        body = super.__str__(self)
+        body = super(ResponseBodyList, self).__str__()
         return "response: %s\nBody: %s" % (self.response, body)