Merge "Object client adds content-length if PUT is empty"
diff --git a/tempest/README.rst b/tempest/README.rst
index 892b0f8..8f07a07 100644
--- a/tempest/README.rst
+++ b/tempest/README.rst
@@ -12,13 +12,13 @@
 and guidelines. Below is the proposed Havana restructuring for Tempest
 to make this clear.
 
-tempest/
-   api/ - API tests
-   cli/ - CLI tests
-   scenario/ - complex scenario tests
-   stress/ - stress tests
-   thirdparty/ - 3rd party api tests
-   whitebox/ - white box testing
+| tempest/
+|    api/ - API tests
+|    cli/ - CLI tests
+|    scenario/ - complex scenario tests
+|    stress/ - stress tests
+|    thirdparty/ - 3rd party api tests
+|    whitebox/ - white box testing
 
 Each of these directories contains different types of tests. What
 belongs in each directory, the rules and examples for good tests, are
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index bcc49aa..c029300 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -44,7 +44,7 @@
         self.assertEqual('200', resp['status'])
         self.assertEqual(self.alt_user, user['name'])
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_by_unauthorized_user(self):
         # Non-admin should not be authorized to create a user
         self.data.setup_test_tenant()
@@ -53,7 +53,7 @@
                           self.alt_password, self.data.tenant['id'],
                           self.alt_email)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_with_empty_name(self):
         # User with an empty name should not be created
         self.data.setup_test_tenant()
@@ -61,15 +61,15 @@
                           self.alt_password, self.data.tenant['id'],
                           self.alt_email)
 
-    @attr(type='gate')
-    def test_create_user_with_name_length_over_64(self):
-        # Length of user name filed should be restricted to 64 characters
+    @attr(type=['negative', 'gate'])
+    def test_create_user_with_name_length_over_255(self):
+        # Length of user name filed should be restricted to 255 characters
         self.data.setup_test_tenant()
         self.assertRaises(exceptions.BadRequest, self.client.create_user,
-                          'a' * 65, self.alt_password,
+                          'a' * 256, self.alt_password,
                           self.data.tenant['id'], self.alt_email)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_with_duplicate_name(self):
         # Duplicate user should not be created
         self.data.setup_test_user()
@@ -78,7 +78,7 @@
                           self.data.tenant['id'], self.data.test_email)
 
     @testtools.skip("Until Bug #999084 is fixed")
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_with_empty_password(self):
         # User with an empty password should not be created
         self.data.setup_test_tenant()
@@ -87,7 +87,7 @@
                           self.alt_email)
 
     @testtools.skip("Until Bug #999084 is fixed")
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_with_long_password(self):
         # User having password exceeding max length should not be created
         self.data.setup_test_tenant()
@@ -96,21 +96,21 @@
                           self.alt_email)
 
     @testtools.skip("Until Bug #999084 is fixed")
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_with_invalid_email_format(self):
         # Email format should be validated while creating a user
         self.data.setup_test_tenant()
         self.assertRaises(exceptions.BadRequest, self.client.create_user,
                           self.alt_user, '', self.data.tenant['id'], '12345')
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_for_non_existant_tenant(self):
         # Attempt to create a user in a non-existent tenant should fail
         self.assertRaises(exceptions.NotFound, self.client.create_user,
                           self.alt_user, self.alt_password, '49ffgg99999',
                           self.alt_email)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_create_user_request_without_a_token(self):
         # Request to create a user without a valid token should fail
         self.data.setup_test_tenant()
@@ -136,7 +136,7 @@
         resp, body = self.client.delete_user(user['id'])
         self.assertEquals('204', resp['status'])
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_delete_users_by_unauthorized_user(self):
         # Non admin user should not be authorized to delete a user
         self.data.setup_test_user()
@@ -144,7 +144,7 @@
                           self.non_admin_client.delete_user,
                           self.data.user['id'])
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_delete_non_existant_user(self):
         # Attempt to delete a non-existent user should fail
         self.assertRaises(exceptions.NotFound, self.client.delete_user,
@@ -163,7 +163,7 @@
                                             self.data.test_tenant)
         self.assertEqual('200', resp['status'])
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_authentication_for_disabled_user(self):
         # Disabled user's token should not get authenticated
         self.data.setup_test_user()
@@ -173,7 +173,7 @@
                           self.data.test_password,
                           self.data.test_tenant)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_authentication_when_tenant_is_disabled(self):
         # User's token for a disabled tenant should not be authenticated
         self.data.setup_test_user()
@@ -183,7 +183,7 @@
                           self.data.test_password,
                           self.data.test_tenant)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_authentication_with_invalid_tenant(self):
         # User's token for an invalid tenant should not be authenticated
         self.data.setup_test_user()
@@ -192,7 +192,7 @@
                           self.data.test_password,
                           'junktenant1234')
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_authentication_with_invalid_username(self):
         # Non-existent user's token should not get authenticated
         self.data.setup_test_user()
@@ -200,7 +200,7 @@
                           'junkuser123', self.data.test_password,
                           self.data.test_tenant)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_authentication_with_invalid_password(self):
         # User's token with invalid password should not be authenticated
         self.data.setup_test_user()
@@ -234,14 +234,14 @@
                         Contains(self.data.test_user),
                         "Could not find %s" % self.data.test_user)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_get_users_by_unauthorized_user(self):
         # Non admin user should not be authorized to get user list
         self.data.setup_test_user()
         self.assertRaises(exceptions.Unauthorized,
                           self.non_admin_client.get_users)
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_get_users_request_without_token(self):
         # Request to get list of users without a valid token should fail
         token = self.client.get_auth()
@@ -316,7 +316,7 @@
                          "Failed to find user %s in fetched list" %
                          ', '.join(m_user for m_user in missing_users))
 
-    @attr(type='gate')
+    @attr(type=['negative', 'gate'])
     def test_list_users_with_invalid_tenant(self):
         # Should not be able to return a list of all
         # users for a nonexistant tenant
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 2839da4..fc510cb 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -128,9 +128,9 @@
         resp, snapshot = cls.snapshots_client.create_snapshot(volume_id,
                                                               **kwargs)
         assert 200 == resp.status
+        cls.snapshots.append(snapshot)
         cls.snapshots_client.wait_for_snapshot_status(snapshot['id'],
                                                       'available')
-        cls.snapshots.append(snapshot)
         return snapshot
 
     #NOTE(afazekas): these create_* and clean_* could be defined
@@ -141,8 +141,8 @@
         """Wrapper utility that returns a test volume."""
         resp, volume = cls.volumes_client.create_volume(size, **kwargs)
         assert 200 == resp.status
-        cls.volumes_client.wait_for_volume_status(volume['id'], 'available')
         cls.volumes.append(volume)
+        cls.volumes_client.wait_for_volume_status(volume['id'], 'available')
         return volume
 
     @classmethod
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 68ab745..eda7153 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -21,7 +21,6 @@
 
 
 class VolumesGetTest(base.BaseVolumeTest):
-
     _interface = "json"
 
     @classmethod
@@ -29,22 +28,17 @@
         super(VolumesGetTest, cls).setUpClass()
         cls.client = cls.volumes_client
 
-    def _volume_create_get_delete(self, image_ref=None):
+    def _volume_create_get_delete(self, **kwargs):
         # Create a volume, Get it's details and Delete the volume
         try:
             volume = {}
-            v_name = rand_name('Volume-')
-            metadata = {'Type': 'work'}
+            v_name = rand_name('Volume')
+            metadata = {'Type': 'Test'}
             #Create a volume
-            if not image_ref:
-                resp, volume = self.client.create_volume(size=1,
-                                                         display_name=v_name,
-                                                         metadata=metadata)
-            else:
-                resp, volume = self.client.create_volume(size=1,
-                                                         display_name=v_name,
-                                                         metadata=metadata,
-                                                         imageRef=image_ref)
+            resp, volume = self.client.create_volume(size=1,
+                                                     display_name=v_name,
+                                                     metadata=metadata,
+                                                     **kwargs)
             self.assertEqual(200, resp.status)
             self.assertTrue('id' in volume)
             self.assertTrue('display_name' in volume)
@@ -107,11 +101,17 @@
 
     @attr(type='smoke')
     def test_volume_create_get_delete(self):
-        self._volume_create_get_delete(image_ref=None)
+        self._volume_create_get_delete()
 
     @attr(type='smoke')
-    def test_volume_from_image(self):
-        self._volume_create_get_delete(image_ref=self.config.compute.image_ref)
+    def test_volume_create_get_delete_from_image(self):
+        self._volume_create_get_delete(imageRef=self.config.compute.image_ref)
+
+    @attr(type='gate')
+    def test_volume_create_get_delete_as_clone(self):
+        origin = self.create_volume(size=1,
+                                    display_name="Volume Origin")
+        self._volume_create_get_delete(source_volid=origin['id'])
 
 
 class VolumesGetTestXML(VolumesGetTest):
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 7480833..89891d2 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -139,6 +139,7 @@
 
     #NOTE(afazekas): doctored test case,
     # with normal validation it would fail
+    @testtools.skip("Until Bug #1182679 is fixed")
     @attr(type='smoke')
     def test_integration_1(self):
         # EC2 1. integration test (not strict)