Merge "Adding description for testcases - compute part10"
This commit is contained in:
commit
2c306e295d
@ -20,6 +20,8 @@ from tempest.lib import exceptions as lib_exc
|
||||
|
||||
|
||||
class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
"""Negative tests of listing servers"""
|
||||
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
@ -45,7 +47,7 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('24a26f1a-1ddc-4eea-b0d7-a90cc874ad8f')
|
||||
def test_list_servers_with_a_deleted_server(self):
|
||||
# Verify deleted servers do not show by default in list servers
|
||||
"""Test that deleted servers do not show by default in list servers"""
|
||||
# List servers and verify server not returned
|
||||
body = self.client.list_servers()
|
||||
servers = body['servers']
|
||||
@ -56,7 +58,7 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('ff01387d-c7ad-47b4-ae9e-64fa214638fe')
|
||||
def test_list_servers_by_non_existing_image(self):
|
||||
# Listing servers for a non existing image returns empty list
|
||||
"""Test listing servers for a non existing image returns empty list"""
|
||||
body = self.client.list_servers(image='non_existing_image')
|
||||
servers = body['servers']
|
||||
self.assertEmpty(servers)
|
||||
@ -64,7 +66,7 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('5913660b-223b-44d4-a651-a0fbfd44ca75')
|
||||
def test_list_servers_by_non_existing_flavor(self):
|
||||
# Listing servers by non existing flavor returns empty list
|
||||
"""Test listing servers by non existing flavor returns empty list"""
|
||||
body = self.client.list_servers(flavor='non_existing_flavor')
|
||||
servers = body['servers']
|
||||
self.assertEmpty(servers)
|
||||
@ -72,7 +74,12 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('e2c77c4a-000a-4af3-a0bd-629a328bde7c')
|
||||
def test_list_servers_by_non_existing_server_name(self):
|
||||
# Listing servers for a non existent server name returns empty list
|
||||
"""Test listing servers for a non existent server name
|
||||
|
||||
Listing servers for a non existent server name should return empty
|
||||
list.
|
||||
"""
|
||||
|
||||
body = self.client.list_servers(name='non_existing_server_name')
|
||||
servers = body['servers']
|
||||
self.assertEmpty(servers)
|
||||
@ -80,9 +87,13 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('fcdf192d-0f74-4d89-911f-1ec002b822c4')
|
||||
def test_list_servers_status_non_existing(self):
|
||||
# When invalid status is specified, up to microversion 2.37,
|
||||
# an empty list is returned, and starting from microversion 2.38,
|
||||
# a 400 error is returned in that case.
|
||||
"""Test listing servers with non existing status
|
||||
|
||||
When invalid status is specified, up to microversion 2.37,
|
||||
an empty list is returned, and starting from microversion 2.38,
|
||||
a 400 error is returned in that case.
|
||||
"""
|
||||
|
||||
if self.is_requested_microversion_compatible('2.37'):
|
||||
body = self.client.list_servers(status='non_existing_status')
|
||||
servers = body['servers']
|
||||
@ -94,6 +105,12 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('d47c17fb-eebd-4287-8e95-f20a7e627b18')
|
||||
def test_list_servers_by_limits_greater_than_actual_count(self):
|
||||
"""Test listing servers by limit greater than actual count
|
||||
|
||||
Listing servers by limit greater than actual count should return
|
||||
all servers.
|
||||
"""
|
||||
|
||||
# Gather the complete list of servers in the project for reference
|
||||
full_list = self.client.list_servers()['servers']
|
||||
# List servers by specifying a greater value for limit
|
||||
@ -104,21 +121,21 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('679bc053-5e70-4514-9800-3dfab1a380a6')
|
||||
def test_list_servers_by_limits_pass_string(self):
|
||||
# Return an error if a string value is passed for limit
|
||||
"""Test listing servers by non-integer limit should fail"""
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
|
||||
limit='testing')
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('62610dd9-4713-4ee0-8beb-fd2c1aa7f950')
|
||||
def test_list_servers_by_limits_pass_negative_value(self):
|
||||
# Return an error if a negative value for limit is passed
|
||||
"""Test listing servers by negative limit should fail"""
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
|
||||
limit=-1)
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('87d12517-e20a-4c9c-97b6-dd1628d6d6c9')
|
||||
def test_list_servers_by_changes_since_invalid_date(self):
|
||||
# Return an error when invalid date format is passed
|
||||
"""Test listing servers by invalid changes-since format should fail"""
|
||||
params = {'changes-since': '2011/01/01'}
|
||||
self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
|
||||
**params)
|
||||
@ -126,7 +143,12 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('74745ad8-b346-45b5-b9b8-509d7447fc1f')
|
||||
def test_list_servers_by_changes_since_future_date(self):
|
||||
# Return an empty list when a date in the future is passed.
|
||||
"""Test listing servers by a future changes-since date
|
||||
|
||||
Return an empty list when a date in the future is passed as
|
||||
changes-since value.
|
||||
"""
|
||||
|
||||
# updated_at field may haven't been set at the point in the boot
|
||||
# process where build_request still exists, so add
|
||||
# {'status': 'ACTIVE'} along with changes-since as filter.
|
||||
@ -138,7 +160,7 @@ class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('93055106-2d34-46fe-af68-d9ddbf7ee570')
|
||||
def test_list_servers_detail_server_is_deleted(self):
|
||||
# Server details are not listed for a deleted server
|
||||
"""Test listing servers detail should not contain deleted server"""
|
||||
body = self.client.list_servers(detail=True)
|
||||
servers = body['servers']
|
||||
actual = [srv for srv in servers
|
||||
|
@ -19,11 +19,15 @@ from tempest.lib import decorators
|
||||
|
||||
|
||||
class MultipleCreateTestJSON(base.BaseV2ComputeTest):
|
||||
"""Test creating multiple servers in one request"""
|
||||
create_default_network = True
|
||||
|
||||
@decorators.idempotent_id('61e03386-89c3-449c-9bb1-a06f423fd9d1')
|
||||
def test_multiple_create(self):
|
||||
# Creating server with min_count=2, 2 servers will be created.
|
||||
"""Test creating multiple servers in one request
|
||||
|
||||
Creating server with min_count=2, 2 servers will be created.
|
||||
"""
|
||||
tenant_network = self.get_tenant_network()
|
||||
body, servers = compute.create_test_server(
|
||||
self.os_primary,
|
||||
@ -40,8 +44,12 @@ class MultipleCreateTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('864777fb-2f1e-44e3-b5b9-3eb6fa84f2f7')
|
||||
def test_multiple_create_with_reservation_return(self):
|
||||
# Creating multiple servers with return_reservation_id=True,
|
||||
# reservation_id will be returned.
|
||||
"""Test creating multiple servers with return_reservation_id=True
|
||||
|
||||
Creating multiple servers with return_reservation_id=True,
|
||||
reservation_id will be returned.
|
||||
"""
|
||||
|
||||
body = self.create_test_server(wait_until='ACTIVE',
|
||||
min_count=1,
|
||||
max_count=2,
|
||||
|
@ -19,11 +19,12 @@ from tempest.lib import exceptions as lib_exc
|
||||
|
||||
|
||||
class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
"""Negative tests of creating multiple servers in one request"""
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('daf29d8d-e928-4a01-9a8c-b129603f3fc0')
|
||||
def test_min_count_less_than_one(self):
|
||||
# Creating server with min_count=0 should fail.
|
||||
"""Test creating server with min_count=0 should fail"""
|
||||
invalid_min_count = 0
|
||||
self.assertRaises(lib_exc.BadRequest, self.create_test_server,
|
||||
min_count=invalid_min_count)
|
||||
@ -31,7 +32,7 @@ class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('999aa722-d624-4423-b813-0d1ac9884d7a')
|
||||
def test_min_count_non_integer(self):
|
||||
# Creating server with non-integer min_count should fail.
|
||||
"""Test creating server with non-integer min_count should fail"""
|
||||
invalid_min_count = 2.5
|
||||
self.assertRaises(lib_exc.BadRequest, self.create_test_server,
|
||||
min_count=invalid_min_count)
|
||||
@ -39,7 +40,7 @@ class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('a6f9c2ab-e060-4b82-b23c-4532cb9390ff')
|
||||
def test_max_count_less_than_one(self):
|
||||
# Creating server with max_count < 1 shoudld fail.
|
||||
"""Test creating server with max_count < 1 shoudld fail"""
|
||||
invalid_max_count = 0
|
||||
self.assertRaises(lib_exc.BadRequest, self.create_test_server,
|
||||
max_count=invalid_max_count)
|
||||
@ -47,7 +48,7 @@ class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('9c5698d1-d7af-4c80-b971-9d403135eea2')
|
||||
def test_max_count_non_integer(self):
|
||||
# Creating server with non-integer max_count should fail.
|
||||
"""Test creating server with non-integer max_count should fail"""
|
||||
invalid_max_count = 2.5
|
||||
self.assertRaises(lib_exc.BadRequest, self.create_test_server,
|
||||
max_count=invalid_max_count)
|
||||
@ -55,7 +56,7 @@ class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('476da616-f1ef-4271-a9b1-b9fc87727cdf')
|
||||
def test_max_count_less_than_min_count(self):
|
||||
# Creating server with max_count less than min_count should fail.
|
||||
"""Test creating server with max_count < min_count should fail"""
|
||||
min_count = 3
|
||||
max_count = 2
|
||||
self.assertRaises(lib_exc.BadRequest, self.create_test_server,
|
||||
|
@ -18,6 +18,8 @@ from tempest.lib import decorators
|
||||
|
||||
|
||||
class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
"""Test server metadata"""
|
||||
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
@ -37,7 +39,10 @@ class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('479da087-92b3-4dcf-aeb3-fd293b2d14ce')
|
||||
def test_list_server_metadata(self):
|
||||
# All metadata key/value pairs for a server should be returned
|
||||
"""Test listing server metadata
|
||||
|
||||
All metadata key/value pairs for a server should be returned.
|
||||
"""
|
||||
resp_metadata = (self.client.list_server_metadata(self.server['id'])
|
||||
['metadata'])
|
||||
|
||||
@ -47,7 +52,10 @@ class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('211021f6-21de-4657-a68f-908878cfe251')
|
||||
def test_set_server_metadata(self):
|
||||
# The server's metadata should be replaced with the provided values
|
||||
"""Test setting server metadata
|
||||
|
||||
The server's metadata should be replaced with the provided values
|
||||
"""
|
||||
# Create a new set of metadata for the server
|
||||
req_metadata = {'meta2': 'data2', 'meta3': 'data3'}
|
||||
self.client.set_server_metadata(self.server['id'], req_metadata)
|
||||
@ -60,8 +68,10 @@ class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('344d981e-0c33-4997-8a5d-6c1d803e4134')
|
||||
def test_update_server_metadata(self):
|
||||
# The server's metadata values should be updated to the
|
||||
# provided values
|
||||
"""Test updating server metadata
|
||||
|
||||
The server's metadata values should be updated to the provided values.
|
||||
"""
|
||||
meta = {'key1': 'alt1', 'key3': 'value3'}
|
||||
self.client.update_server_metadata(self.server['id'], meta)
|
||||
|
||||
@ -73,8 +83,11 @@ class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('0f58d402-e34a-481d-8af8-b392b17426d9')
|
||||
def test_update_metadata_empty_body(self):
|
||||
# The original metadata should not be lost if empty metadata body is
|
||||
# passed
|
||||
"""Test updating server metadata to empty values
|
||||
|
||||
The original server metadata should not be lost if empty metadata
|
||||
body is passed.
|
||||
"""
|
||||
meta = {}
|
||||
self.client.update_server_metadata(self.server['id'], meta)
|
||||
resp_metadata = (self.client.list_server_metadata(self.server['id'])
|
||||
@ -84,15 +97,19 @@ class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('3043c57d-7e0e-49a6-9a96-ad569c265e6a')
|
||||
def test_get_server_metadata_item(self):
|
||||
# The value for a specific metadata key should be returned
|
||||
"""Test getting specific server metadata item"""
|
||||
meta = self.client.show_server_metadata_item(self.server['id'],
|
||||
'key2')['meta']
|
||||
self.assertEqual('value2', meta['key2'])
|
||||
|
||||
@decorators.idempotent_id('58c02d4f-5c67-40be-8744-d3fa5982eb1c')
|
||||
def test_set_server_metadata_item(self):
|
||||
# The item's value should be updated to the provided value
|
||||
# Update the metadata value
|
||||
"""Test updating specific server metadata item
|
||||
|
||||
The metadata item's value should be updated to the provided value.
|
||||
"""
|
||||
|
||||
# Update the metadata value.
|
||||
meta = {'nova': 'alt'}
|
||||
self.client.set_server_metadata_item(self.server['id'], 'nova', meta)
|
||||
|
||||
@ -104,7 +121,10 @@ class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('127642d6-4c7b-4486-b7cd-07265a378658')
|
||||
def test_delete_server_metadata_item(self):
|
||||
# The metadata value/key pair should be deleted from the server
|
||||
"""Test deleting server metadata item
|
||||
|
||||
The metadata value/key pair should be deleted from the server.
|
||||
"""
|
||||
self.client.delete_server_metadata_item(self.server['id'], 'key1')
|
||||
|
||||
# Verify the metadata item has been removed
|
||||
|
@ -20,6 +20,8 @@ from tempest.lib import exceptions as lib_exc
|
||||
|
||||
|
||||
class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
"""Negative tests of server metadata"""
|
||||
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
@ -36,6 +38,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('fe114a8f-3a57-4eff-9ee2-4e14628df049')
|
||||
def test_server_create_metadata_key_too_long(self):
|
||||
"""Test creating server with too long metadata key should fail"""
|
||||
# Attempt to start a server with a meta-data key that is > 255
|
||||
# characters
|
||||
|
||||
@ -52,7 +55,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('92431555-4d8b-467c-b95b-b17daa5e57ff')
|
||||
def test_create_server_metadata_blank_key(self):
|
||||
# Blank key should trigger an error.
|
||||
"""Test creating server with blank metadata key should fail"""
|
||||
meta = {'': 'data1'}
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.create_test_server,
|
||||
@ -61,6 +64,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('4d9cd7a3-2010-4b41-b8fe-3bbf0b169466')
|
||||
def test_server_metadata_non_existent_server(self):
|
||||
"""Test getting metadata item for a non existent server should fail"""
|
||||
# GET on a non-existent server should not succeed
|
||||
non_existent_server_id = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
@ -71,7 +75,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('f408e78e-3066-4097-9299-3b0182da812e')
|
||||
def test_list_server_metadata_non_existent_server(self):
|
||||
# List metadata on a non-existent server should not succeed
|
||||
"""Test listing metadata for a non existent server should fail"""
|
||||
non_existent_server_id = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.client.list_server_metadata,
|
||||
@ -80,8 +84,10 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('0025fbd6-a4ba-4cde-b8c2-96805dcfdabc')
|
||||
def test_wrong_key_passed_in_body(self):
|
||||
# Raise BadRequest if key in uri does not match
|
||||
# the key passed in body.
|
||||
"""Test setting server metadata item with wrong key in body
|
||||
|
||||
Raise BadRequest if key in uri does not match the key passed in body.
|
||||
"""
|
||||
meta = {'testkey': 'testvalue'}
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.client.set_server_metadata_item,
|
||||
@ -90,7 +96,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('0df38c2a-3d4e-4db5-98d8-d4d9fa843a12')
|
||||
def test_set_metadata_non_existent_server(self):
|
||||
# Set metadata on a non-existent server should not succeed
|
||||
"""Test setting metadata for a non existent server should fail"""
|
||||
non_existent_server_id = data_utils.rand_uuid()
|
||||
meta = {'meta1': 'data1'}
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
@ -101,7 +107,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('904b13dc-0ef2-4e4c-91cd-3b4a0f2f49d8')
|
||||
def test_update_metadata_non_existent_server(self):
|
||||
# An update should not happen for a non-existent server
|
||||
"""Test updating metadata for a non existent server should fail"""
|
||||
non_existent_server_id = data_utils.rand_uuid()
|
||||
meta = {'key1': 'value1', 'key2': 'value2'}
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
@ -112,7 +118,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('a452f38c-05c2-4b47-bd44-a4f0bf5a5e48')
|
||||
def test_update_metadata_with_blank_key(self):
|
||||
# Blank key should trigger an error
|
||||
"""Test updating server metadata to blank key should fail"""
|
||||
meta = {'': 'data1'}
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.client.update_server_metadata,
|
||||
@ -121,7 +127,10 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('6bbd88e1-f8b3-424d-ba10-ae21c45ada8d')
|
||||
def test_delete_metadata_non_existent_server(self):
|
||||
# Should not be able to delete metadata item from a non-existent server
|
||||
"""Test deleting metadata item from a non existent server
|
||||
|
||||
Should not be able to delete metadata item from a non-existent server.
|
||||
"""
|
||||
non_existent_server_id = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.client.delete_server_metadata_item,
|
||||
@ -131,9 +140,11 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('d8c0a210-a5c3-4664-be04-69d96746b547')
|
||||
def test_metadata_items_limit(self):
|
||||
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
|
||||
# will be raised while exceeding metadata items limit for
|
||||
# tenant.
|
||||
"""Test set/update server metadata over limit should fail
|
||||
|
||||
A 403 Forbidden or 413 Overlimit (old behaviour) exception
|
||||
will be raised while exceeding metadata items limit for project.
|
||||
"""
|
||||
quota_set = self.quotas_client.show_quota_set(
|
||||
self.tenant_id)['quota_set']
|
||||
quota_metadata = quota_set['metadata_items']
|
||||
@ -157,8 +168,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('96100343-7fa9-40d8-80fa-d29ef588ce1c')
|
||||
def test_set_server_metadata_blank_key(self):
|
||||
# Raise a bad request error for blank key.
|
||||
# set_server_metadata will replace all metadata with new value
|
||||
"""Test setting server metadata with blank key should fail"""
|
||||
meta = {'': 'data1'}
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.client.set_server_metadata,
|
||||
@ -167,8 +177,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('64a91aee-9723-4863-be44-4c9d9f1e7d0e')
|
||||
def test_set_server_metadata_missing_metadata(self):
|
||||
# Raise a bad request error for a missing metadata field
|
||||
# set_server_metadata will replace all metadata with new value
|
||||
"""Test setting server metadata without metadata field should fail"""
|
||||
meta = {'meta1': 'data1'}
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.client.set_server_metadata,
|
||||
|
@ -19,6 +19,8 @@ from tempest.lib import decorators
|
||||
|
||||
|
||||
class ServerPasswordTestJSON(base.BaseV2ComputeTest):
|
||||
"""Test server password"""
|
||||
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
@ -28,8 +30,10 @@ class ServerPasswordTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('f83b582f-62a8-4f22-85b0-0dee50ff783a')
|
||||
def test_get_server_password(self):
|
||||
"""Test getting password of a server"""
|
||||
self.servers_client.show_password(self.server['id'])
|
||||
|
||||
@decorators.idempotent_id('f8229e8b-b625-4493-800a-bde86ac611ea')
|
||||
def test_delete_server_password(self):
|
||||
"""Test deleting password from a server"""
|
||||
self.servers_client.delete_password(self.server['id'])
|
||||
|
@ -25,6 +25,7 @@ CONF = config.CONF
|
||||
|
||||
|
||||
class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
"""Test servers API"""
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
@ -37,8 +38,11 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
enable_instance_password,
|
||||
'Instance password not available.')
|
||||
def test_create_server_with_admin_password(self):
|
||||
# If an admin password is provided on server creation, the server's
|
||||
# root password should be set to that password.
|
||||
"""Test creating server with admin password
|
||||
|
||||
If an admin password is provided on server creation, the server's
|
||||
root password should be set to that password.
|
||||
"""
|
||||
server = self.create_test_server(adminPass='testpassword')
|
||||
self.addCleanup(self.delete_server, server['id'])
|
||||
|
||||
@ -47,8 +51,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('8fea6be7-065e-47cf-89b8-496e6f96c699')
|
||||
def test_create_with_existing_server_name(self):
|
||||
# Creating a server with a name that already exists is allowed
|
||||
|
||||
"""Test creating a server with already existing name is allowed"""
|
||||
# TODO(sdague): clear out try, we do cleanup one layer up
|
||||
server_name = data_utils.rand_name(
|
||||
self.__class__.__name__ + '-server')
|
||||
@ -69,8 +72,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('f9e15296-d7f9-4e62-b53f-a04e89160833')
|
||||
def test_create_specify_keypair(self):
|
||||
# Specify a keypair while creating a server
|
||||
|
||||
"""Test creating server with keypair"""
|
||||
key_name = data_utils.rand_name('key')
|
||||
self.keypairs_client.create_keypair(name=key_name)
|
||||
self.addCleanup(self.keypairs_client.delete_keypair, key_name)
|
||||
@ -97,7 +99,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('5e6ccff8-349d-4852-a8b3-055df7988dd2')
|
||||
def test_update_server_name(self):
|
||||
# The server name should be changed to the provided value
|
||||
"""Test updating server name to the provided value"""
|
||||
server = self.create_test_server(wait_until='ACTIVE')
|
||||
self.addCleanup(self.delete_server, server['id'])
|
||||
# Update instance name with non-ASCII characters
|
||||
@ -115,7 +117,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('89b90870-bc13-4b73-96af-f9d4f2b70077')
|
||||
def test_update_access_server_address(self):
|
||||
# The server's access addresses should reflect the provided values
|
||||
"""Test updating server's access addresses to the provided value"""
|
||||
server = self.create_test_server(wait_until='ACTIVE')
|
||||
self.addCleanup(self.delete_server, server['id'])
|
||||
|
||||
@ -132,7 +134,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('38fb1d02-c3c5-41de-91d3-9bc2025a75eb')
|
||||
def test_create_server_with_ipv6_addr_only(self):
|
||||
# Create a server without an IPv4 address(only IPv6 address).
|
||||
"""Test creating server with ipv6 address only(no ipv4 address)"""
|
||||
server = self.create_test_server(accessIPv6='2001:2001::3',
|
||||
wait_until='ACTIVE')
|
||||
self.addCleanup(self.delete_server, server['id'])
|
||||
@ -142,17 +144,22 @@ class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.related_bug('1730756')
|
||||
@decorators.idempotent_id('defbaca5-d611-49f5-ae21-56ee25d2db49')
|
||||
def test_create_server_specify_multibyte_character_name(self):
|
||||
# prefix character is:
|
||||
# http://unicode.org/cldr/utility/character.jsp?a=20A1
|
||||
"""Test creating server with multi character name
|
||||
|
||||
# We use a string with 3 byte utf-8 character due to nova
|
||||
# will return 400(Bad Request) if we attempt to send a name which has
|
||||
# 4 byte utf-8 character.
|
||||
prefix character is:
|
||||
http://unicode.org/cldr/utility/character.jsp?a=20A1
|
||||
|
||||
We use a string with 3 byte utf-8 character due to nova
|
||||
will return 400(Bad Request) if we attempt to send a name which has
|
||||
4 byte utf-8 character.
|
||||
"""
|
||||
utf8_name = data_utils.rand_name(b'\xe2\x82\xa1'.decode('utf-8'))
|
||||
self.create_test_server(name=utf8_name, wait_until='ACTIVE')
|
||||
|
||||
|
||||
class ServerShowV247Test(base.BaseV2ComputeTest):
|
||||
"""Test servers API with compute microversion greater than 2.46"""
|
||||
|
||||
min_microversion = '2.47'
|
||||
max_microversion = 'latest'
|
||||
|
||||
@ -164,12 +171,14 @@ class ServerShowV247Test(base.BaseV2ComputeTest):
|
||||
|
||||
@decorators.idempotent_id('88b0bdb2-494c-11e7-a919-92ebcb67fe33')
|
||||
def test_show_server(self):
|
||||
"""Test getting server detail"""
|
||||
server = self.create_test_server()
|
||||
# All fields will be checked by API schema
|
||||
self.servers_client.show_server(server['id'])
|
||||
|
||||
@decorators.idempotent_id('8de397c2-57d0-4b90-aa30-e5d668f21a8b')
|
||||
def test_update_rebuild_list_server(self):
|
||||
"""Test update/rebuild/list server"""
|
||||
server = self.create_test_server()
|
||||
# Checking update API response schema
|
||||
self.servers_client.update_server(server['id'])
|
||||
@ -184,6 +193,8 @@ class ServerShowV247Test(base.BaseV2ComputeTest):
|
||||
|
||||
|
||||
class ServerShowV263Test(base.BaseV2ComputeTest):
|
||||
"""Test servers API with compute microversion greater than 2.62"""
|
||||
|
||||
min_microversion = '2.63'
|
||||
max_microversion = 'latest'
|
||||
|
||||
@ -195,6 +206,7 @@ class ServerShowV263Test(base.BaseV2ComputeTest):
|
||||
'required to test image certificate validation.')
|
||||
@decorators.idempotent_id('71b8e3d5-11d2-494f-b917-b094a4afed3c')
|
||||
def test_show_update_rebuild_list_server(self):
|
||||
"""Test show/update/rebuild/list server"""
|
||||
trusted_certs = CONF.compute.certified_image_trusted_certs
|
||||
server = self.create_test_server(
|
||||
image_id=CONF.compute.certified_image_ref,
|
||||
|
@ -28,6 +28,8 @@ CONF = config.CONF
|
||||
# TODO(mriedem): Remove this test class once the nova queens branch goes into
|
||||
# extended maintenance mode.
|
||||
class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
|
||||
"""Test virtual interfaces API with compute microversion less than 2.44"""
|
||||
|
||||
max_microversion = '2.43'
|
||||
|
||||
depends_on_nova_network = True
|
||||
@ -47,9 +49,7 @@ class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('96c4e2ef-5e4d-4d7f-87f5-fed6dca18016')
|
||||
@utils.services('network')
|
||||
def test_list_virtual_interfaces(self):
|
||||
# Positive test:Should be able to GET the virtual interfaces list
|
||||
# for a given server_id
|
||||
|
||||
"""Test listing virtual interfaces of a server"""
|
||||
if CONF.service_available.neutron:
|
||||
with testtools.ExpectedException(exceptions.BadRequest):
|
||||
self.client.list_virtual_interfaces(self.server['id'])
|
||||
|
@ -23,6 +23,12 @@ from tempest.lib import exceptions as lib_exc
|
||||
# TODO(mriedem): Remove this test class once the nova queens branch goes into
|
||||
# extended maintenance mode.
|
||||
class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
"""Negative tests of virtual interfaces API
|
||||
|
||||
Negative tests of virtual interfaces API for compute microversion less
|
||||
than 2.44.
|
||||
"""
|
||||
|
||||
max_microversion = '2.43'
|
||||
|
||||
depends_on_nova_network = True
|
||||
@ -37,8 +43,7 @@ class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
@decorators.idempotent_id('64ebd03c-1089-4306-93fa-60f5eb5c803c')
|
||||
@utils.services('network')
|
||||
def test_list_virtual_interfaces_invalid_server_id(self):
|
||||
# Negative test: Should not be able to GET virtual interfaces
|
||||
# for an invalid server_id
|
||||
"""Test listing virtual interfaces of an invalid server should fail"""
|
||||
invalid_server_id = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.servers_client.list_virtual_interfaces,
|
||||
|
Loading…
Reference in New Issue
Block a user