Add "reboot_instance" EC2 API test
Currently, in "tempest/thirdparty/boto/test_ec2_instance_run.py",
no test case present to test the "reboot_instance" api, similar
to stop_instance, terminate_instance, etc.
Closes-Bug: #1352341
Change-Id: Ifbd8607566961dbf32b40f34ff603f712d856f6a
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index c0d3f7a..ee904c7 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -200,6 +200,29 @@
instance.terminate()
self.assertInstanceStateWait(instance, '_GONE')
+ def test_run_reboot_terminate_instance(self):
+ # EC2 run, await till it reaches to running state, then reboot,
+ # and wait untill its state is running, and then terminate
+ image_ami = self.ec2_client.get_image(self.images["ami"]
+ ["image_id"])
+ reservation = image_ami.run(kernel_id=self.images["aki"]["image_id"],
+ ramdisk_id=self.images["ari"]["image_id"],
+ instance_type=self.instance_type)
+
+ self.assertEqual(1, len(reservation.instances))
+
+ instance = reservation.instances[0]
+ if instance.state != "running":
+ self.assertInstanceStateWait(instance, "running")
+
+ instance.reboot()
+ if instance.state != "running":
+ self.assertInstanceStateWait(instance, "running")
+ LOG.debug("Instance rebooted - state: %s", instance.state)
+
+ instance.terminate()
+ self.assertInstanceStateWait(instance, '_GONE')
+
def test_compute_with_volumes(self):
# EC2 1. integration test (not strict)
image_ami = self.ec2_client.get_image(self.images["ami"]["image_id"])