Adding description for testcases - compute part6

When Tempest is used in customer site, often we are required to
provide a testcase list including testcase names and descriptions.
Now no this kind of doc is available, so we can add descriptions
with the format of doc string for every testcase, so later we
can generata such a testcase description list.

There are hundreds of testcases missing descriptions, so we can
add them gradually, and limit the modified files in one patch
for the convenience of reviewing.

Change-Id: I1469ad5a34bac75203b2eb063326eded096706a5
partially-implements: blueprint testcase-description
This commit is contained in:
zhufl 2020-08-10 16:30:28 +08:00
parent 24961f6244
commit 4e726a6691
10 changed files with 118 additions and 47 deletions

View File

@ -18,7 +18,7 @@ from tempest.lib import decorators
class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
"""Tests Agents API"""
"""Tests Compute Agents API"""
@classmethod
def setup_clients(cls):
@ -46,7 +46,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('1fc6bdc8-0b6d-4cc7-9f30-9b04fabe5b90')
def test_create_agent(self):
# Create an agent.
"""Test creating a compute agent"""
params = self._param_helper(
hypervisor='kvm', os='win', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx',
@ -58,6 +58,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('dc9ffd51-1c50-4f0e-a820-ae6d2a568a9e')
def test_update_agent(self):
"""Test updating a compute agent"""
# Create and update an agent.
body = self.client.create_agent(**self.params_agent)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
@ -71,7 +72,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('470e0b89-386f-407b-91fd-819737d0b335')
def test_delete_agent(self):
# Create an agent and delete it.
"""Test deleting a compute agent"""
body = self.client.create_agent(**self.params_agent)['agent']
self.client.delete_agent(body['agent_id'])
@ -82,7 +83,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')
def test_list_agents(self):
# Create an agent and list all agents.
"""Test listing compute agents"""
body = self.client.create_agent(**self.params_agent)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
agents = self.client.list_agents()['agents']
@ -91,7 +92,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('eabadde4-3cd7-4ec4-a4b5-5a936d2d4408')
def test_list_agents_with_filter(self):
# Create agents and list the agent builds by the filter.
"""Test listing compute agents by the filter"""
body = self.client.create_agent(**self.params_agent)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
params = self._param_helper(

View File

@ -46,7 +46,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0621c53e-d45d-40e7-951d-43e5e257b272')
def test_flavor_access_list_with_public_flavor(self):
# Test to list flavor access with exceptions by querying public flavor
"""Test listing flavor access of a public flavor should fail"""
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='True')
self.assertRaises(lib_exc.NotFound,
@ -56,7 +56,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('41eaaade-6d37-4f28-9c74-f21b46ca67bd')
def test_flavor_non_admin_add(self):
# Test to add flavor access as a user without admin privileges.
"""Test adding flavor access by a non-admin user is forbidden"""
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
self.assertRaises(lib_exc.Forbidden,
@ -67,7 +67,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('073e79a6-c311-4525-82dc-6083d919cb3a')
def test_flavor_non_admin_remove(self):
# Test to remove flavor access as a user without admin privileges.
"""Test removing flavor access by a non-admin user should fail"""
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
@ -84,6 +84,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('f3592cc0-0306-483c-b210-9a7b5346eddc')
def test_add_flavor_access_duplicate(self):
"""Test adding duplicate flavor access to same flavor should fail"""
# Create a new flavor.
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
@ -104,6 +105,7 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1f710927-3bc7-4381-9f82-0ca6e42644b7')
def test_remove_flavor_access_not_found(self):
"""Test removing non existent flavor access should fail"""
# Create a new flavor.
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')

View File

@ -24,6 +24,8 @@ CONF = config.CONF
class LiveMigrationNegativeTest(base.BaseV2ComputeAdminTest):
"""Negative tests of live migration"""
@classmethod
def skip_checks(cls):
super(LiveMigrationNegativeTest, cls).skip_checks()
@ -40,7 +42,7 @@ class LiveMigrationNegativeTest(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7fb7856e-ae92-44c9-861a-af62d7830bcb')
def test_invalid_host_for_migration(self):
# Migrating to an invalid host should not change the status
"""Test migrating to an invalid host should not change the status"""
target_host = data_utils.rand_name('host')
server = self.create_test_server(wait_until="ACTIVE")
@ -52,6 +54,7 @@ class LiveMigrationNegativeTest(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6e2f94f5-2ee8-4830-bef5-5bc95bb0795b')
def test_live_block_migration_suspended(self):
"""Test migrating a suspended server should not change the status"""
server = self.create_test_server(wait_until="ACTIVE")
self.admin_servers_client.suspend_server(server['id'])

View File

@ -97,9 +97,11 @@ class QuotasAdminTestBase(base.BaseV2ComputeAdminTest):
class QuotasAdminTestJSON(QuotasAdminTestBase):
"""Test compute quotas by admin user"""
@decorators.idempotent_id('3b0a7c8f-cf58-46b8-a60c-715a32a8ba7d')
def test_get_default_quotas(self):
# Admin can get the default resource quota set for a tenant
"""Test admin can get the default compute quota set for a project"""
expected_quota_set = self.default_quota_set | set(['id'])
quota_set = self.adm_client.show_default_quota_set(
self.demo_tenant_id)['quota_set']
@ -109,7 +111,7 @@ class QuotasAdminTestJSON(QuotasAdminTestBase):
@decorators.idempotent_id('55fbe2bf-21a9-435b-bbd2-4162b0ed799a')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
"""Test admin can update all the compute quota limits for a project"""
default_quota_set = self.adm_client.show_default_quota_set(
self.demo_tenant_id)['quota_set']
new_quota_set = {'metadata_items': 256, 'ram': 10240,
@ -140,11 +142,12 @@ class QuotasAdminTestJSON(QuotasAdminTestBase):
# TODO(afazekas): merge these test cases
@decorators.idempotent_id('ce9e0815-8091-4abd-8345-7fe5b85faa1d')
def test_get_updated_quotas(self):
"""Test that GET shows the updated quota set of project"""
self._get_updated_quotas()
@decorators.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
def test_delete_quota(self):
# Admin can delete the resource quota set for a project
"""Test admin can delete the compute quota set for a project"""
project_name = data_utils.rand_name('ram_quota_project')
project_desc = project_name + '-desc'
project = identity.identity_utils(self.os_admin).create_project(
@ -165,26 +168,40 @@ class QuotasAdminTestJSON(QuotasAdminTestBase):
class QuotasAdminTestV236(QuotasAdminTestBase):
min_microversion = '2.36'
"""Test compute quotas with microversion greater than 2.35
# NOTE(gmann): This test tests the Quota APIs response schema
# for 2.36 microversion. No specific assert or behaviour verification
# is needed.
"""
min_microversion = '2.36'
@decorators.idempotent_id('4268b5c9-92e5-4adc-acf1-3a2798f3d803')
def test_get_updated_quotas(self):
# Checking Quota update, get, get details APIs response schema
"""Test compute quotas API with microversion greater than 2.35
Checking compute quota update, get, get details APIs response schema.
"""
self._get_updated_quotas()
class QuotasAdminTestV257(QuotasAdminTestBase):
min_microversion = '2.57'
"""Test compute quotas with microversion greater than 2.56
# NOTE(gmann): This test tests the Quota APIs response schema
# for 2.57 microversion. No specific assert or behaviour verification
# is needed.
"""
min_microversion = '2.57'
@decorators.idempotent_id('e641e6c6-e86c-41a4-9e5c-9493c0ae47ad')
def test_get_updated_quotas(self):
# Checking Quota update, get, get details APIs response schema
"""Test compute quotas API with microversion greater than 2.56
Checking compute quota update, get, get details APIs response schema.
"""
self._get_updated_quotas()
@ -212,6 +229,7 @@ class QuotaClassesAdminTestJSON(base.BaseV2ComputeAdminTest):
# 'danger' flag.
@decorators.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
def test_update_default_quotas(self):
"""Test updating default compute quota class set"""
# get the current 'default' quota class values
body = (self.adm_client.show_quota_class_set('default')
['quota_class_set'])

View File

@ -18,6 +18,7 @@ from tempest.lib import exceptions as lib_exc
class ServerDiagnosticsNegativeTest(base.BaseV2ComputeAdminTest):
"""Negative tests of server diagnostics"""
@classmethod
def setup_clients(cls):
@ -27,7 +28,10 @@ class ServerDiagnosticsNegativeTest(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e84e2234-60d2-42fa-8b30-e2d3049724ac')
def test_get_server_diagnostics_by_non_admin(self):
# Non-admin user cannot view server diagnostics according to policy
"""Test getting server diagnostics by non-admin user is forbidden
Non-admin user cannot view server diagnostics according to policy.
"""
server_id = self.create_test_server(wait_until='ACTIVE')['id']
self.assertRaises(lib_exc.Forbidden,
self.client.show_server_diagnostics, server_id)

View File

@ -45,7 +45,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('06f960bb-15bb-48dc-873d-f96e89be7870')
def test_list_servers_filter_by_error_status(self):
# Filter the list of servers by server error status
"""Test filtering the list of servers by server error status"""
params = {'status': 'error'}
self.client.reset_state(self.s1_id, state='error')
body = self.non_admin_client.list_servers(**params)
@ -61,6 +61,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('d56e9540-73ed-45e0-9b88-98fc419087eb')
def test_list_servers_detailed_filter_by_invalid_status(self):
"""Test filtering the list of servers by invalid server status"""
params = {'status': 'invalid_status'}
if self.is_requested_microversion_compatible('2.37'):
body = self.client.list_servers(detail=True, **params)
@ -72,8 +73,11 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('51717b38-bdc1-458b-b636-1cf82d99f62f')
def test_list_servers_by_admin(self):
# Listing servers by admin user returns a list which doesn't
# contain the other tenants' server by default
"""Test listing servers by admin without other projects
Listing servers by admin user returns a list which doesn't
contain the other projects' server by default.
"""
body = self.client.list_servers(detail=True)
servers = body['servers']
@ -85,8 +89,11 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('9f5579ae-19b4-4985-a091-2a5d56106580')
def test_list_servers_by_admin_with_all_tenants(self):
# Listing servers by admin user with all tenants parameter
# Here should be listed all servers
"""Test listing servers by admin with all tenants
Listing servers by admin user with all tenants parameter,
all servers should be listed.
"""
params = {'all_tenants': ''}
body = self.client.list_servers(detail=True, **params)
servers = body['servers']
@ -98,8 +105,10 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.related_bug('1659811')
@decorators.idempotent_id('7e5d6b8f-454a-4ba1-8ae2-da857af8338b')
def test_list_servers_by_admin_with_specified_tenant(self):
# In nova v2, tenant_id is ignored unless all_tenants is specified
"""Test listing servers by admin with specified project
In nova v2, tenant_id is ignored unless all_tenants is specified.
"""
# List the primary tenant but get nothing due to odd specified behavior
tenant_id = self.non_admin_client.tenant_id
params = {'tenant_id': tenant_id}
@ -128,7 +137,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('86c7a8f7-50cf-43a9-9bac-5b985317134f')
def test_list_servers_filter_by_exist_host(self):
# Filter the list of servers by existent host
"""Test filtering the list of servers by existent host"""
server = self.client.show_server(self.s1_id)['server']
hostname = server['OS-EXT-SRV-ATTR:host']
params = {'host': hostname, 'all_tenants': '1'}
@ -144,6 +153,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1')
def test_reset_state_server(self):
"""Test resetting server state to error/active"""
# Reset server's state to 'error'
self.client.reset_state(self.s1_id, state='error')
@ -160,9 +170,11 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('682cb127-e5bb-4f53-87ce-cb9003604442')
def test_rebuild_server_in_error_state(self):
# The server in error state should be rebuilt using the provided
# image and changed to ACTIVE state
"""Test rebuilding server in error state
The server in error state should be rebuilt using the provided
image and changed to ACTIVE state.
"""
# resetting vm state require admin privilege
self.client.reset_state(self.s1_id, state='error')
rebuilt_server = self.non_admin_client.rebuild_server(
@ -188,6 +200,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('7a1323b4-a6a2-497a-96cb-76c07b945c71')
def test_reset_network_inject_network_info(self):
"""Test resetting and injecting network info of a server"""
# Reset Network of a Server
server = self.create_test_server(wait_until='ACTIVE')
self.client.reset_network(server['id'])
@ -196,6 +209,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('fdcd9b33-0903-4e00-a1f7-b5f6543068d6')
def test_create_server_with_scheduling_hint(self):
"""Test creating server with scheduling hint"""
# Create a server with scheduler hints.
hints = {
'same_host': self.s1_id

View File

@ -26,7 +26,7 @@ CONF = config.CONF
class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
"""Tests Servers API using admin privileges"""
"""Negative Tests of Servers API using admin privileges"""
@classmethod
def setup_clients(cls):
@ -47,6 +47,7 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
'Resize not available.')
@decorators.attr(type=['negative'])
def test_resize_server_using_overlimit_ram(self):
"""Test resizing server using over limit ram should fail"""
# NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
self.useFixture(fixtures.LockFixture('compute_quotas'))
quota_set = self.quotas_client.show_quota_set(
@ -69,6 +70,7 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
'Resize not available.')
@decorators.attr(type=['negative'])
def test_resize_server_using_overlimit_vcpus(self):
"""Test resizing server using over limit vcpus should fail"""
# NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
self.useFixture(fixtures.LockFixture('compute_quotas'))
quota_set = self.quotas_client.show_quota_set(
@ -89,6 +91,7 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('b0b4d8af-1256-41ef-9ee7-25f1c19dde80')
def test_reset_state_server_invalid_state(self):
"""Test resetting server state to invalid state value should fail"""
self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state='invalid')
@ -96,6 +99,7 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('4cdcc984-fab0-4577-9a9d-6d558527ee9d')
def test_reset_state_server_invalid_type(self):
"""Test resetting server state to invalid state type should fail"""
self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state=1)
@ -103,13 +107,14 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e741298b-8df2-46f0-81cb-8f814ff2504c')
def test_reset_state_server_nonexistent_server(self):
"""Test resetting a non existent server's state should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.reset_state, '999', state='error')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('46a4e1ca-87ae-4d28-987a-1b6b136a0221')
def test_migrate_non_existent_server(self):
# migrate a non existent server
"""Test migrating a non existent server should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.migrate_server,
data_utils.rand_uuid())
@ -121,6 +126,7 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
'Suspend is not available.')
@decorators.attr(type=['negative'])
def test_migrate_server_invalid_state(self):
"""Test migrating a server with invalid state should fail"""
# create server.
server = self.create_test_server(wait_until='ACTIVE')
server_id = server['id']

View File

@ -28,6 +28,8 @@ CONF = config.CONF
class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
"""Test image metadata with compute microversion less than 2.39"""
max_microversion = '2.38'
@classmethod
@ -89,7 +91,10 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('37ec6edd-cf30-4c53-bd45-ae74db6b0531')
def test_list_image_metadata(self):
# All metadata key/value pairs for an image should be returned
"""Test listing image metadata
All metadata key/value pairs for an image should be returned.
"""
resp_metadata = self.client.list_image_metadata(self.image_id)
expected = {'metadata': {
'os_version': 'value1', 'os_distro': 'value2'}}
@ -97,7 +102,10 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('ece7befc-d3ce-42a4-b4be-c3067a418c29')
def test_set_image_metadata(self):
# The metadata for the image should match the new values
"""Test setting image metadata
The metadata for the image should match the new values.
"""
req_metadata = {'os_version': 'value2', 'architecture': 'value3'}
self.client.set_image_metadata(self.image_id,
req_metadata)
@ -108,7 +116,10 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('7b491c11-a9d5-40fe-a696-7f7e03d3fea2')
def test_update_image_metadata(self):
# The metadata for the image should match the updated values
"""Test updating image medata
The metadata for the image should match the updated values.
"""
req_metadata = {'os_version': 'alt1', 'architecture': 'value3'}
self.client.update_image_metadata(self.image_id,
req_metadata)
@ -122,15 +133,21 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('4f5db52f-6685-4c75-b848-f4bb363f9aa6')
def test_get_image_metadata_item(self):
# The value for a specific metadata key should be returned
"""Test getting image metadata item
The value for a specific metadata key should be returned.
"""
meta = self.client.show_image_metadata_item(self.image_id,
'os_distro')['meta']
self.assertEqual('value2', meta['os_distro'])
@decorators.idempotent_id('f2de776a-4778-4d90-a5da-aae63aee64ae')
def test_set_image_metadata_item(self):
# The value provided for the given meta item should be set for
# the image
"""Test setting image metadata item
The value provided for the given meta item should be set for
the image.
"""
meta = {'os_version': 'alt'}
self.client.set_image_metadata_item(self.image_id,
'os_version', meta)
@ -140,7 +157,10 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('a013796c-ba37-4bb5-8602-d944511def14')
def test_delete_image_metadata_item(self):
# The metadata value/key pair should be deleted from the image
"""Test deleting image metadata item
The metadata value/key pair should be deleted from the image.
"""
self.client.delete_image_metadata_item(self.image_id,
'os_version')
resp_metadata = self.client.list_image_metadata(self.image_id)

View File

@ -20,6 +20,11 @@ from tempest.lib import exceptions as lib_exc
class ImagesMetadataNegativeTestJSON(base.BaseV2ComputeTest):
"""Negative tests of image metadata
Negative tests of image metadata with compute microversion less than 2.39.
"""
max_microversion = '2.38'
@classmethod
@ -30,15 +35,14 @@ class ImagesMetadataNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('94069db2-792f-4fa8-8bd3-2271a6e0c095')
def test_list_nonexistent_image_metadata(self):
# Negative test: List on nonexistent image
# metadata should not happen
"""Test listing metadata of a non existence image should fail"""
self.assertRaises(lib_exc.NotFound, self.client.list_image_metadata,
data_utils.rand_uuid())
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a403ef9e-9f95-427c-b70a-3ce3388796f1')
def test_update_nonexistent_image_metadata(self):
# Negative test:An update should not happen for a non-existent image
"""Test updating metadata of a non existence image should fail"""
meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
self.assertRaises(lib_exc.NotFound,
self.client.update_image_metadata,
@ -47,7 +51,7 @@ class ImagesMetadataNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('41ae052c-6ee6-405c-985e-5712393a620d')
def test_get_nonexistent_image_metadata_item(self):
# Negative test: Get on non-existent image should not happen
"""Test getting metadata of a non existence image should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.show_image_metadata_item,
data_utils.rand_uuid(), 'os_version')
@ -55,7 +59,7 @@ class ImagesMetadataNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('dc64f2ce-77e8-45b0-88c8-e15041d08eaf')
def test_set_nonexistent_image_metadata(self):
# Negative test: Metadata should not be set to a non-existent image
"""Test setting metadata of a non existence image should fail"""
meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
self.assertRaises(lib_exc.NotFound, self.client.set_image_metadata,
data_utils.rand_uuid(), meta)
@ -63,8 +67,7 @@ class ImagesMetadataNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('2154fd03-ab54-457c-8874-e6e3eb56e9cf')
def test_set_nonexistent_image_metadata_item(self):
# Negative test: Metadata item should not be set to a
# nonexistent image
"""Test setting metadata item of a non existence image should fail"""
meta = {'os_distro': 'alt'}
self.assertRaises(lib_exc.NotFound,
self.client.set_image_metadata_item,
@ -74,8 +77,7 @@ class ImagesMetadataNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('848e157f-6bcf-4b2e-a5dd-5124025a8518')
def test_delete_nonexistent_image_metadata_item(self):
# Negative test: Shouldn't be able to delete metadata
# item from non-existent image
"""Test deleting metadata item of a non existence image should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.delete_image_metadata_item,
data_utils.rand_uuid(), 'os_distro')

View File

@ -20,6 +20,7 @@ from tempest.lib import decorators
class QuotasTestJSON(base.BaseV2ComputeTest):
"""Test compute quotas"""
@classmethod
def skip_checks(cls):
@ -59,7 +60,7 @@ class QuotasTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('f1ef0a97-dbbb-4cca-adc5-c9fbc4f76107')
def test_get_quotas(self):
# User can get the quota set for it's tenant
"""Test user can get the compute quota set for it's project"""
expected_quota_set = self.default_quota_set | set(['id'])
quota_set = self.client.show_quota_set(self.tenant_id)['quota_set']
self.assertEqual(quota_set['id'], self.tenant_id)
@ -75,7 +76,7 @@ class QuotasTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('9bfecac7-b966-4f47-913f-1a9e2c12134a')
def test_get_default_quotas(self):
# User can get the default quota set for it's tenant
"""Test user can get the default compute quota set for it's project"""
expected_quota_set = self.default_quota_set | set(['id'])
quota_set = (self.client.show_default_quota_set(self.tenant_id)
['quota_set'])
@ -85,7 +86,7 @@ class QuotasTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('cd65d997-f7e4-4966-a7e9-d5001b674fdc')
def test_compare_tenant_quotas_with_default_quotas(self):
# Tenants are created with the default quota values
"""Test tenants are created with the default compute quota values"""
default_quota_set = \
self.client.show_default_quota_set(self.tenant_id)['quota_set']
tenant_quota_set = (self.client.show_quota_set(self.tenant_id)