blob: 3c31e77c77e5a56039b10ed2a3bc2933404baa2c [file] [log] [blame]
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +09001# Copyright 2014 NEC Corporation. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import testtools
16
17from tempest.api.compute import base
18from tempest import config
19from tempest import test
20
21CONF = config.CONF
22
23
24class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
25
26 @classmethod
Rohan Kanade60b73092015-02-04 17:58:19 +053027 def setup_clients(cls):
28 super(MigrationsAdminTest, cls).setup_clients()
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090029 cls.client = cls.os_adm.migrations_client
30
31 @test.attr(type='gate')
Chris Hoge7579c1a2015-02-26 14:12:15 -080032 @test.idempotent_id('75c0b83d-72a0-4cf8-a153-631e83e7d53f')
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090033 def test_list_migrations(self):
34 # Admin can get the migrations list
David Kranz5cf4ba42015-02-10 14:00:50 -050035 self.client.list_migrations()
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090036
Chris Hoge7579c1a2015-02-26 14:12:15 -080037 @test.idempotent_id('1b512062-8093-438e-b47a-37d2f597cd64')
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090038 @testtools.skipUnless(CONF.compute_feature_enabled.resize,
39 'Resize not available.')
40 @test.attr(type='gate')
41 def test_list_migrations_in_flavor_resize_situation(self):
42 # Admin can get the migrations list which contains the resized server
David Kranz0fb14292015-02-11 15:55:20 -050043 server = self.create_test_server(wait_until="ACTIVE")
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090044 server_id = server['id']
45
David Kranzae99b9a2015-02-16 13:37:01 -050046 self.servers_client.resize(server_id, self.flavor_ref_alt)
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090047 self.servers_client.wait_for_server_status(server_id, 'VERIFY_RESIZE')
48 self.servers_client.confirm_resize(server_id)
49 self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
50
David Kranz5cf4ba42015-02-10 14:00:50 -050051 body = self.client.list_migrations()
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090052
53 instance_uuids = [x['instance_uuid'] for x in body]
54 self.assertIn(server_id, instance_uuids)