Add a boot-snapshot-boot test
It occurred to me that we do not (AFAIK) have a test that shows that
we can boot servers from snapshots we create right after we create
them. This adds one.
Change-Id: I613357e8c9cc6d382caaf7291e150448148f32dd
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py
index 91ce1f9..d47ffce 100644
--- a/tempest/api/compute/images/test_images.py
+++ b/tempest/api/compute/images/test_images.py
@@ -128,3 +128,27 @@
wait_for_server=False)
self.addCleanup(self.client.delete_image, image['id'])
self.assertEqual(snapshot_name, image['name'])
+
+ @decorators.idempotent_id('f3cac456-e3fe-4183-a7a7-a59f7f017088')
+ def test_create_server_from_snapshot(self):
+ # Create one server normally
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.addCleanup(self.servers_client.delete_server, server['id'])
+
+ # Snapshot it
+ 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'])
+
+ # Try to create another server from that snapshot
+ server2 = self.create_test_server(wait_until='ACTIVE',
+ image_id=image['id'])
+
+ # Delete server 2 before we finish otherwise we'll race with
+ # the cleanup which tries to delete the image before the
+ # server is gone.
+ self.servers_client.delete_server(server2['id'])
+ waiters.wait_for_server_termination(self.servers_client, server2['id'])