Merge "Adding additional assertions for retype test"
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 9fc5af0..350e8ba 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -369,6 +369,42 @@
server = self.client.show_server(self.server_id)['server']
self.assertEqual(self.flavor_ref, server['flavor']['id'])
+ @decorators.idempotent_id('fbbf075f-a812-4022-bc5c-ccb8047eef12')
+ @decorators.related_bug('1737599')
+ @testtools.skipUnless(CONF.compute_feature_enabled.resize,
+ 'Resize not available.')
+ @utils.services('volume')
+ def test_resize_server_revert_with_volume_attached(self):
+ # Tests attaching a volume to a server instance and then resizing
+ # the instance. Once the instance is resized, revert the resize which
+ # should move the instance and volume attachment back to the original
+ # compute host.
+
+ # Create a blank volume and attach it to the server created in setUp.
+ volume = self.create_volume()
+ server = self.client.show_server(self.server_id)['server']
+ self.attach_volume(server, volume)
+ # Now resize the server with the blank volume attached.
+ self.client.resize_server(self.server_id, self.flavor_ref_alt)
+ # Explicitly delete the server to get a new one for later
+ # tests. Avoids resize down race issues.
+ self.addCleanup(self.delete_server, self.server_id)
+ waiters.wait_for_server_status(
+ self.client, self.server_id, 'VERIFY_RESIZE')
+ # Now revert the resize which should move the instance and it's volume
+ # attachment back to the original source compute host.
+ self.client.revert_resize_server(self.server_id)
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ # Make sure everything still looks OK.
+ server = self.client.show_server(self.server_id)['server']
+ # The flavor id is not returned in the server response after
+ # microversion 2.46 so handle that gracefully.
+ if server['flavor'].get('id'):
+ self.assertEqual(self.flavor_ref, server['flavor']['id'])
+ attached_volumes = server['os-extended-volumes:volumes_attached']
+ self.assertEqual(1, len(attached_volumes))
+ self.assertEqual(volume['id'], attached_volumes[0]['id'])
+
@decorators.idempotent_id('b963d4f1-94b3-4c40-9e97-7b583f46e470')
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
'Snapshotting not available, backup not possible.')
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index 97a1f36..72b6be4 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -121,11 +121,7 @@
# Create a domain with a user and a group in it
domain = self.setup_test_domain()
user = self.create_test_user(domain_id=domain['id'])
- group = self.groups_client.create_group(
- name=data_utils.rand_name('group'),
- domain_id=domain['id'])['group']
- self.addCleanup(test_utils.call_and_ignore_notfound_exc,
- self.groups_client.delete_group, group['id'])
+ group = self.setup_test_group(domain_id=domain['id'])
# Delete the domain
self.delete_domain(domain['id'])
# Check the domain, its users and groups are gone
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 507810b..37ce266 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -30,50 +30,46 @@
@decorators.idempotent_id('2e80343b-6c81-4ac3-88c7-452f3e9d5129')
def test_group_create_update_get(self):
+ # Verify group creation works.
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
- group = self.groups_client.create_group(
- name=name, domain_id=self.domain['id'],
- description=description)['group']
- self.addCleanup(self.groups_client.delete_group, group['id'])
+ group = self.setup_test_group(name=name, domain_id=self.domain['id'],
+ description=description)
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
+ self.assertEqual(self.domain['id'], group['domain_id'])
- new_name = data_utils.rand_name('UpdateGroup')
- new_desc = data_utils.rand_name('UpdateDescription')
+ # Verify updating name and description works.
+ first_name_update = data_utils.rand_name('UpdateGroup')
+ first_desc_update = data_utils.rand_name('UpdateDescription')
updated_group = self.groups_client.update_group(
- group['id'], name=new_name, description=new_desc)['group']
- self.assertEqual(updated_group['name'], new_name)
- self.assertEqual(updated_group['description'], new_desc)
+ group['id'], name=first_name_update,
+ description=first_desc_update)['group']
+ self.assertEqual(updated_group['name'], first_name_update)
+ self.assertEqual(updated_group['description'], first_desc_update)
+ # Verify that the updated values are reflected after performing show.
new_group = self.groups_client.show_group(group['id'])['group']
self.assertEqual(group['id'], new_group['id'])
- self.assertEqual(new_name, new_group['name'])
- self.assertEqual(new_desc, new_group['description'])
+ self.assertEqual(first_name_update, new_group['name'])
+ self.assertEqual(first_desc_update, new_group['description'])
- @decorators.idempotent_id('b66eb441-b08a-4a6d-81ab-fef71baeb26c')
- def test_group_update_with_few_fields(self):
- name = data_utils.rand_name('Group')
- old_description = data_utils.rand_name('Description')
- group = self.groups_client.create_group(
- name=name, domain_id=self.domain['id'],
- description=old_description)['group']
- self.addCleanup(self.groups_client.delete_group, group['id'])
-
- new_name = data_utils.rand_name('UpdateGroup')
+ # Verify that updating a single field for a group (name) leaves the
+ # other fields (description, domain_id) unchanged.
+ second_name_update = data_utils.rand_name(
+ self.__class__.__name__ + 'UpdateGroup')
updated_group = self.groups_client.update_group(
- group['id'], name=new_name)['group']
- self.assertEqual(new_name, updated_group['name'])
- # Verify that 'description' is not being updated or deleted.
- self.assertEqual(old_description, updated_group['description'])
+ group['id'], name=second_name_update)['group']
+ self.assertEqual(second_name_update, updated_group['name'])
+ # Verify that 'description' and 'domain_id' were not updated or
+ # deleted.
+ self.assertEqual(first_desc_update, updated_group['description'])
+ self.assertEqual(self.domain['id'], updated_group['domain_id'])
@decorators.attr(type='smoke')
@decorators.idempotent_id('1598521a-2f36-4606-8df9-30772bd51339')
def test_group_users_add_list_delete(self):
- name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(
- name=name, domain_id=self.domain['id'])['group']
- self.addCleanup(self.groups_client.delete_group, group['id'])
+ group = self.setup_test_group(domain_id=self.domain['id'])
# add user into group
users = []
for _ in range(3):
@@ -100,11 +96,8 @@
# create two groups, and add user into them
groups = []
for _ in range(2):
- name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(
- name=name, domain_id=self.domain['id'])['group']
+ group = self.setup_test_group(domain_id=self.domain['id'])
groups.append(group)
- self.addCleanup(self.groups_client.delete_group, group['id'])
self.groups_client.add_group_user(group['id'], user['id'])
# list groups which user belongs to
user_groups = self.users_client.list_user_groups(user['id'])['groups']
@@ -118,12 +111,7 @@
group_ids = list()
fetched_ids = list()
for _ in range(3):
- name = data_utils.rand_name('Group')
- description = data_utils.rand_name('Description')
- group = self.groups_client.create_group(
- name=name, domain_id=self.domain['id'],
- description=description)['group']
- self.addCleanup(self.groups_client.delete_group, group['id'])
+ group = self.setup_test_group(domain_id=self.domain['id'])
group_ids.append(group['id'])
# List and Verify Groups
# When domain specific drivers are enabled the operations
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index 0845407..532f0d7 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -201,10 +201,7 @@
role_id = self.setup_test_role()['id']
# Create a group.
- group_name = data_utils.rand_name('Group')
- group_id = self.groups_client.create_group(
- name=group_name, domain_id=domain_id)['group']['id']
- self.addCleanup(self.groups_client.delete_group, group_id)
+ group_id = self.setup_test_group(domain_id=domain_id)['id']
# Add the alt user to the group.
self.groups_client.add_group_user(group_id, alt_user_id)
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 68f2c07..282343c 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -292,6 +292,20 @@
self.delete_domain, domain['id'])
return domain
+ def setup_test_group(self, **kwargs):
+ """Set up a test group."""
+ if 'name' not in kwargs:
+ kwargs['name'] = data_utils.rand_name(
+ self.__class__.__name__ + '_test_project')
+ if 'description' not in kwargs:
+ kwargs['description'] = data_utils.rand_name(
+ self.__class__.__name__ + '_test_description')
+ group = self.groups_client.create_group(**kwargs)['group']
+ self.addCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ self.groups_client.delete_group, group['id'])
+ return group
+
class BaseApplicationCredentialsV3Test(BaseIdentityV3Test):
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 9965fe5..145dcf1 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -443,7 +443,9 @@
disk_format=img_disk_format,
properties=img_properties)
except IOError:
- LOG.debug("A qcow2 image was not found. Try to get a uec image.")
+ LOG.warning(
+ "A(n) %s image was not found. Retrying with uec image.",
+ img_disk_format)
kernel = self._image_create('scenario-aki', 'aki', aki_img_path)
ramdisk = self._image_create('scenario-ari', 'ari', ari_img_path)
properties = {'kernel_id': kernel, 'ramdisk_id': ramdisk}