Added tests for Nova microversion v2.47

This microversion changes flavor property in server response.
New test case was added to do not overload some other testcase
by running all tests for two microversions (v2.1 and v2.47)

Also method create_test_server was modified. Now it adds field
'network' into request if microversion >= v2.37 because since
this microversion this field is required.

Change-Id: If7420d0c6153fe63c049c0f6dc9a748968d40315
This commit is contained in:
Sergey Nikitin 2017-06-04 22:09:56 +04:00 committed by Ghanshyam Mann
parent d61cc59a0b
commit 8654e5b0d6
6 changed files with 67 additions and 1 deletions

View File

@ -326,6 +326,10 @@ Microversion tests implemented in Tempest
.. _2.42: http://docs.openstack.org/developer/nova/api_microversion_history.html#maximum-in-ocata
* `2.47`_
.. _2.47: http://docs.openstack.org/developer/nova/api_microversion_history.html#id42
* Volume
* `3.3`_

View File

@ -22,6 +22,7 @@ from tempest.common import compute
from tempest.common import waiters
from tempest import config
from tempest import exceptions
from tempest.lib.common import api_version_request
from tempest.lib.common import api_version_utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
@ -202,6 +203,15 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
"""
if 'name' not in kwargs:
kwargs['name'] = data_utils.rand_name(cls.__name__ + "-server")
request_version = api_version_request.APIVersionRequest(
cls.request_microversion)
v2_37_version = api_version_request.APIVersionRequest('2.37')
# NOTE(snikitin): since microversion v2.37 'networks' field is required
if request_version >= v2_37_version and 'networks' not in kwargs:
kwargs['networks'] = 'none'
tenant_network = cls.get_tenant_network()
body, servers = compute.create_test_server(
cls.os_primary,

View File

@ -134,3 +134,14 @@ class ServersTestJSON(base.BaseV2ComputeTest):
waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
server = self.client.show_server(server['id'])['server']
self.assertEqual('2001:2001::3', server['accessIPv6'])
class ServerShowV247Test(base.BaseV2ComputeTest):
min_microversion = '2.47'
max_microversion = 'latest'
@decorators.idempotent_id('88b0bdb2-494c-11e7-a919-92ebcb67fe33')
def test_show_server(self):
server = self.create_test_server()
# All fields will be checked by API schema
self.servers_client.show_server(server['id'])

View File

@ -0,0 +1,39 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
from tempest.lib.api_schema.response.compute.v2_26 import servers as servers226
flavor = {
'type': 'object',
'properties': {
'original_name': {'type': 'string'},
'disk': {'type': 'integer'},
'ephemeral': {'type': 'integer'},
'ram': {'type': 'integer'},
'swap': {'type': 'integer'},
'vcpus': {'type': 'integer'},
'extra_specs': {
'type': 'object',
'patternProperties': {
'^[a-zA-Z0-9_\-\. :]+$': {'type': 'string'}
}
}
},
'additionalProperties': False,
'required': ['original_name', 'disk', 'ephemeral', 'ram', 'swap', 'vcpus']
}
get_server = copy.deepcopy(servers226.get_server)
get_server['response_body']['properties']['server'][
'properties'].update({'flavor': flavor})

View File

@ -27,6 +27,7 @@ from tempest.lib.api_schema.response.compute.v2_16 import servers as schemav216
from tempest.lib.api_schema.response.compute.v2_19 import servers as schemav219
from tempest.lib.api_schema.response.compute.v2_26 import servers as schemav226
from tempest.lib.api_schema.response.compute.v2_3 import servers as schemav23
from tempest.lib.api_schema.response.compute.v2_47 import servers as schemav247
from tempest.lib.api_schema.response.compute.v2_6 import servers as schemav26
from tempest.lib.api_schema.response.compute.v2_9 import servers as schemav29
from tempest.lib.common import rest_client
@ -43,7 +44,8 @@ class ServersClient(base_compute_client.BaseComputeClient):
{'min': '2.9', 'max': '2.15', 'schema': schemav29},
{'min': '2.16', 'max': '2.18', 'schema': schemav216},
{'min': '2.19', 'max': '2.25', 'schema': schemav219},
{'min': '2.26', 'max': None, 'schema': schemav226}]
{'min': '2.26', 'max': '2.46', 'schema': schemav226},
{'min': '2.47', 'max': None, 'schema': schemav247}]
def __init__(self, auth_provider, service, region,
enable_instance_password=True, **kwargs):