Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 1 | # 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 | |
| 15 | import testtools |
| 16 | |
| 17 | from tempest.api.compute import base |
| 18 | from tempest import config |
| 19 | from tempest import test |
| 20 | |
| 21 | CONF = config.CONF |
| 22 | |
| 23 | |
| 24 | class MigrationsAdminTest(base.BaseV2ComputeAdminTest): |
| 25 | |
| 26 | @classmethod |
Andrea Frittoli | 50bb80d | 2014-09-15 12:34:27 +0100 | [diff] [blame] | 27 | def resource_setup(cls): |
| 28 | super(MigrationsAdminTest, cls).resource_setup() |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 29 | cls.client = cls.os_adm.migrations_client |
| 30 | |
| 31 | @test.attr(type='gate') |
| 32 | def test_list_migrations(self): |
| 33 | # Admin can get the migrations list |
| 34 | resp, _ = self.client.list_migrations() |
| 35 | self.assertEqual(200, resp.status) |
| 36 | |
| 37 | @testtools.skipUnless(CONF.compute_feature_enabled.resize, |
| 38 | 'Resize not available.') |
| 39 | @test.attr(type='gate') |
| 40 | def test_list_migrations_in_flavor_resize_situation(self): |
| 41 | # Admin can get the migrations list which contains the resized server |
| 42 | resp, server = self.create_test_server(wait_until="ACTIVE") |
| 43 | server_id = server['id'] |
| 44 | |
| 45 | resp, _ = self.servers_client.resize(server_id, self.flavor_ref_alt) |
| 46 | self.assertEqual(202, resp.status) |
| 47 | 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 | |
| 51 | resp, body = self.client.list_migrations() |
| 52 | self.assertEqual(200, resp.status) |
| 53 | |
| 54 | instance_uuids = [x['instance_uuid'] for x in body] |
| 55 | self.assertIn(server_id, instance_uuids) |