Merge "Add compute response schema for microversion 2.75"

This commit is contained in:
Zuul 2022-03-09 13:44:19 +00:00 committed by Gerrit Code Review
commit fd708dc272
6 changed files with 121 additions and 22 deletions

View File

@ -442,6 +442,10 @@ Microversion tests implemented in Tempest
.. _2.73: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id66
* `2.75`_
.. _2.75: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id68
* `2.79`_
.. _2.79: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-train

View File

@ -223,3 +223,32 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
}
self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')
class ServersAdmin275Test(base.BaseV2ComputeAdminTest):
"""Test compute server with microversion greater than 2.75
# NOTE(gmann): This test tests the Server APIs response schema
# for 2.75 microversion. No specific assert or behaviour verification
# is needed.
"""
min_microversion = '2.75'
@decorators.idempotent_id('bf2b4a00-73a3-4d53-81fa-acbcd97d6339')
def test_rebuild_update_server_275(self):
server = self.create_test_server()
# Checking update response schema.
self.servers_client.update_server(server['id'])
waiters.wait_for_server_status(self.servers_client, server['id'],
'ACTIVE')
# Checking rebuild API response schema
self.servers_client.rebuild_server(server['id'], self.image_ref_alt)
waiters.wait_for_server_status(self.servers_client,
server['id'], 'ACTIVE')
# Checking rebuild server with admin response schema.
self.os_admin.servers_client.rebuild_server(
server['id'], self.image_ref)
self.addCleanup(waiters.wait_for_server_status,
self.os_admin.servers_client,
server['id'], 'ACTIVE')

View File

@ -0,0 +1,64 @@
# 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_57 import servers as servers257
from tempest.lib.api_schema.response.compute.v2_73 import servers as servers273
###########################################################################
#
# 2.75:
#
# Server representation is made consistent among GET, PUT
# and Rebuild serevr APIs response.
#
###########################################################################
rebuild_server = copy.deepcopy(servers273.get_server)
rebuild_server['response_body']['properties']['server'][
'properties'].pop('OS-EXT-SRV-ATTR:user_data')
rebuild_server['status_code'] = [202]
rebuild_server['response_body']['properties']['server'][
'properties'].update({'user_data': servers257.user_data})
rebuild_server['response_body']['properties']['server'][
'required'].append('user_data')
rebuild_server_with_admin_pass = copy.deepcopy(rebuild_server)
rebuild_server_with_admin_pass['response_body']['properties']['server'][
'properties'].update({'adminPass': {'type': 'string'}})
rebuild_server_with_admin_pass['response_body']['properties']['server'][
'required'].append('adminPass')
update_server = copy.deepcopy(servers273.get_server)
# NOTE(gmann): Below are the unchanged schema in this microversion. We
# need to keep this schema in this file to have the generic way to select the
# right schema based on self.schema_versions_info mapping in service client.
# ****** Schemas unchanged since microversion 2.73 ***
get_server = copy.deepcopy(servers273.get_server)
list_servers = copy.deepcopy(servers273.list_servers)
list_servers_detail = copy.deepcopy(servers273.list_servers_detail)
show_server_diagnostics = copy.deepcopy(servers273.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers273.get_remote_consoles)
list_tags = copy.deepcopy(servers273.list_tags)
update_all_tags = copy.deepcopy(servers273.update_all_tags)
delete_all_tags = copy.deepcopy(servers273.delete_all_tags)
check_tag_existence = copy.deepcopy(servers273.check_tag_existence)
update_tag = copy.deepcopy(servers273.update_tag)
delete_tag = copy.deepcopy(servers273.delete_tag)
attach_volume = copy.deepcopy(servers273.attach_volume)
show_volume_attachment = copy.deepcopy(servers273.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers273.list_volume_attachments)
show_instance_action = copy.deepcopy(servers273.show_instance_action)
create_backup = copy.deepcopy(servers273.create_backup)

View File

@ -12,7 +12,7 @@
import copy
from tempest.lib.api_schema.response.compute.v2_73 import servers as servers273
from tempest.lib.api_schema.response.compute.v2_75 import servers as servers275
###########################################################################
@ -27,19 +27,19 @@ from tempest.lib.api_schema.response.compute.v2_73 import servers as servers273
# - POST /servers/{server_id}/os-volume_attachments
###########################################################################
attach_volume = copy.deepcopy(servers273.attach_volume)
attach_volume = copy.deepcopy(servers275.attach_volume)
attach_volume['response_body']['properties']['volumeAttachment'][
'properties'].update({'delete_on_termination': {'type': 'boolean'}})
attach_volume['response_body']['properties']['volumeAttachment'][
'required'].append('delete_on_termination')
show_volume_attachment = copy.deepcopy(servers273.show_volume_attachment)
show_volume_attachment = copy.deepcopy(servers275.show_volume_attachment)
show_volume_attachment['response_body']['properties']['volumeAttachment'][
'properties'].update({'delete_on_termination': {'type': 'boolean'}})
show_volume_attachment['response_body']['properties'][
'volumeAttachment']['required'].append('delete_on_termination')
list_volume_attachments = copy.deepcopy(servers273.list_volume_attachments)
list_volume_attachments = copy.deepcopy(servers275.list_volume_attachments)
list_volume_attachments['response_body']['properties']['volumeAttachments'][
'items']['properties'].update(
{'delete_on_termination': {'type': 'boolean'}})
@ -49,21 +49,21 @@ list_volume_attachments['response_body']['properties'][
# NOTE(zhufl): Below are the unchanged schema in this microversion. We
# need to keep this schema in this file to have the generic way to select the
# right schema based on self.schema_versions_info mapping in service client.
# ****** Schemas unchanged since microversion 2.73 ***
rebuild_server = copy.deepcopy(servers273.rebuild_server)
# ****** Schemas unchanged since microversion 2.75 ***
rebuild_server = copy.deepcopy(servers275.rebuild_server)
rebuild_server_with_admin_pass = copy.deepcopy(
servers273.rebuild_server_with_admin_pass)
update_server = copy.deepcopy(servers273.update_server)
get_server = copy.deepcopy(servers273.get_server)
list_servers_detail = copy.deepcopy(servers273.list_servers_detail)
list_servers = copy.deepcopy(servers273.list_servers)
show_server_diagnostics = copy.deepcopy(servers273.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers273.get_remote_consoles)
list_tags = copy.deepcopy(servers273.list_tags)
update_all_tags = copy.deepcopy(servers273.update_all_tags)
delete_all_tags = copy.deepcopy(servers273.delete_all_tags)
check_tag_existence = copy.deepcopy(servers273.check_tag_existence)
update_tag = copy.deepcopy(servers273.update_tag)
delete_tag = copy.deepcopy(servers273.delete_tag)
show_instance_action = copy.deepcopy(servers273.show_instance_action)
create_backup = copy.deepcopy(servers273.create_backup)
servers275.rebuild_server_with_admin_pass)
update_server = copy.deepcopy(servers275.update_server)
get_server = copy.deepcopy(servers275.get_server)
list_servers_detail = copy.deepcopy(servers275.list_servers_detail)
list_servers = copy.deepcopy(servers275.list_servers)
show_server_diagnostics = copy.deepcopy(servers275.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers275.get_remote_consoles)
list_tags = copy.deepcopy(servers275.list_tags)
update_all_tags = copy.deepcopy(servers275.update_all_tags)
delete_all_tags = copy.deepcopy(servers275.delete_all_tags)
check_tag_existence = copy.deepcopy(servers275.check_tag_existence)
update_tag = copy.deepcopy(servers275.update_tag)
delete_tag = copy.deepcopy(servers275.delete_tag)
show_instance_action = copy.deepcopy(servers275.show_instance_action)
create_backup = copy.deepcopy(servers275.create_backup)

View File

@ -40,6 +40,7 @@ from tempest.lib.api_schema.response.compute.v2_63 import servers as schemav263
from tempest.lib.api_schema.response.compute.v2_70 import servers as schemav270
from tempest.lib.api_schema.response.compute.v2_71 import servers as schemav271
from tempest.lib.api_schema.response.compute.v2_73 import servers as schemav273
from tempest.lib.api_schema.response.compute.v2_75 import servers as schemav275
from tempest.lib.api_schema.response.compute.v2_79 import servers as schemav279
from tempest.lib.api_schema.response.compute.v2_8 import servers as schemav28
from tempest.lib.api_schema.response.compute.v2_9 import servers as schemav29
@ -70,7 +71,8 @@ class ServersClient(base_compute_client.BaseComputeClient):
{'min': '2.63', 'max': '2.69', 'schema': schemav263},
{'min': '2.70', 'max': '2.70', 'schema': schemav270},
{'min': '2.71', 'max': '2.72', 'schema': schemav271},
{'min': '2.73', 'max': '2.78', 'schema': schemav273},
{'min': '2.73', 'max': '2.74', 'schema': schemav273},
{'min': '2.75', 'max': '2.78', 'schema': schemav275},
{'min': '2.79', 'max': None, 'schema': schemav279}]
def __init__(self, auth_provider, service, region,