blob: 2434884ff2fc804937032fac44ba4c6b5f3025d4 [file] [log] [blame]
ghanshyam85a4b0a2018-04-24 11:09:25 +03001# Copyright 2018 NEC Corporation.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.api.compute import base
17from tempest.common import waiters
18from tempest.lib.common.utils import data_utils
19from tempest.lib import decorators
20
21# NOTE(gmann): This file is to write the tests which mainly
22# tests newly added microversion schema related to servers APIs.
23# As per (https://docs.openstack.org/tempest/latest/microversion_testing.
24# html#tempest-scope-for-microversion-testing),
25# we need to fill the API response schema gaps which gets modified
26# during microversion change. To cover the testing of such schema
27# we need to have operation schema test which just test
28# the microversion schemas.
29# If you are adding server APIs microversion schema file without
30# their integration tests, you can add tests to cover those schema
31# in this file.
32
33
34class ServerShowV254Test(base.BaseV2ComputeTest):
35 min_microversion = '2.54'
36 max_microversion = 'latest'
37
38 @decorators.idempotent_id('09170a98-4940-4637-add7-1a35121f1a5a')
39 def test_rebuild_server(self):
40 server = self.create_test_server(wait_until='ACTIVE')
41 keypair_name = data_utils.rand_name(
42 self.__class__.__name__ + '-keypair')
43 kwargs = {'name': keypair_name}
44 self.keypairs_client.create_keypair(**kwargs)
45 self.addCleanup(self.keypairs_client.delete_keypair,
46 keypair_name)
47 # Checking rebuild API response schema
48 self.servers_client.rebuild_server(server['id'], self.image_ref_alt,
49 key_name=keypair_name)
50 waiters.wait_for_server_status(self.servers_client,
51 server['id'], 'ACTIVE')
Ghanshyamd5394652018-04-26 07:59:32 +000052
53
54class ServerShowV257Test(base.BaseV2ComputeTest):
55 min_microversion = '2.57'
56 max_microversion = 'latest'
57
58 @decorators.idempotent_id('803df848-080a-4261-8f11-b020cd9b6f60')
59 def test_rebuild_server(self):
60 server = self.create_test_server(wait_until='ACTIVE')
61 user_data = "ZWNobyAiaGVsbG8gd29ybGQi"
62 # Checking rebuild API response schema
63 self.servers_client.rebuild_server(server['id'], self.image_ref_alt,
64 user_data=user_data)
65 waiters.wait_for_server_status(self.servers_client,
66 server['id'], 'ACTIVE')