diff options
author | lianghao <lianghao@cmss.chinamobile.com> | 2017-03-06 20:02:15 +0800 |
---|---|---|
committer | Liang Hao <lianghao@cmss.chinamobile.com> | 2017-03-08 09:24:45 +0000 |
commit | c08078640562f8627d28f0e9b450371ad7f62b7d (patch) | |
tree | b37ed0940efa29620e8dfc193ec436b31ad922e8 /tempest/api/compute | |
parent | 5e1543f7537a4f95070909a43e9a2ef3e6f843e0 (diff) | |
download | tempest-c08078640562f8627d28f0e9b450371ad7f62b7d.tar.gz |
Add api tests for create-image
add several state of vm,when create image from vm.
Change-Id: Ia52a0acc61fe62e5a519fb23af55f741e54afa7c
Diffstat (limited to 'tempest/api/compute')
-rw-r--r-- | tempest/api/compute/images/test_images.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py index a0c860a15..6fa843d82 100644 --- a/tempest/api/compute/images/test_images.py +++ b/tempest/api/compute/images/test_images.py @@ -64,3 +64,35 @@ class ImagesTestJSON(base.BaseV2ComputeTest): wait_for_server=False) self.addCleanup(self.client.delete_image, image['id']) self.assertEqual(snapshot_name, image['name']) + + @decorators.idempotent_id('71bcb732-0261-11e7-9086-fa163e4fa634') + def test_create_image_from_paused_server(self): + server = self.create_test_server(wait_until='ACTIVE') + self.servers_client.pause_server(server['id']) + waiters.wait_for_server_status(self.servers_client, + server['id'], 'PAUSED') + self.addCleanup(self.servers_client.delete_server, server['id']) + + snapshot_name = data_utils.rand_name('test-snap') + image = self.create_image_from_server(server['id'], + name=snapshot_name, + wait_until='ACTIVE', + wait_for_server=False) + self.addCleanup(self.client.delete_image, image['id']) + self.assertEqual(snapshot_name, image['name']) + + @decorators.idempotent_id('8ca07fec-0262-11e7-907e-fa163e4fa634') + def test_create_image_from_suspended_server(self): + server = self.create_test_server(wait_until='ACTIVE') + self.servers_client.suspend_server(server['id']) + waiters.wait_for_server_status(self.servers_client, + server['id'], 'SUSPENDED') + self.addCleanup(self.servers_client.delete_server, server['id']) + + snapshot_name = data_utils.rand_name('test-snap') + image = self.create_image_from_server(server['id'], + name=snapshot_name, + wait_until='ACTIVE', + wait_for_server=False) + self.addCleanup(self.client.delete_image, image['id']) + self.assertEqual(snapshot_name, image['name']) |