submitting a unit test for terminate_instance
This commit is contained in:
1
Authors
1
Authors
@@ -32,6 +32,7 @@ Jesse Andrews <anotherjesse@gmail.com>
|
|||||||
Joe Heck <heckj@mac.com>
|
Joe Heck <heckj@mac.com>
|
||||||
Joel Moore <joelbm24@gmail.com>
|
Joel Moore <joelbm24@gmail.com>
|
||||||
John Dewey <john@dewey.ws>
|
John Dewey <john@dewey.ws>
|
||||||
|
John Tran <jtran@attinteractive.com>
|
||||||
Jonathan Bryce <jbryce@jbryce.com>
|
Jonathan Bryce <jbryce@jbryce.com>
|
||||||
Jordan Rinke <jordan@openstack.org>
|
Jordan Rinke <jordan@openstack.org>
|
||||||
Josh Durgin <joshd@hq.newdream.net>
|
Josh Durgin <joshd@hq.newdream.net>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ from nova import rpc
|
|||||||
from nova import service
|
from nova import service
|
||||||
from nova import test
|
from nova import test
|
||||||
from nova import utils
|
from nova import utils
|
||||||
|
from nova import exception
|
||||||
from nova.auth import manager
|
from nova.auth import manager
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova.api.ec2 import cloud
|
from nova.api.ec2 import cloud
|
||||||
@@ -310,6 +311,19 @@ class CloudTestCase(test.TestCase):
|
|||||||
LOG.debug(_("Terminating instance %s"), instance_id)
|
LOG.debug(_("Terminating instance %s"), instance_id)
|
||||||
rv = self.compute.terminate_instance(instance_id)
|
rv = self.compute.terminate_instance(instance_id)
|
||||||
|
|
||||||
|
def test_terminate_instances(self):
|
||||||
|
inst1 = db.instance_create(self.context, {'reservation_id': 'a',
|
||||||
|
'image_id': 1,
|
||||||
|
'host': 'host1'})
|
||||||
|
terminate_instances = self.cloud.terminate_instances
|
||||||
|
# valid instance_id
|
||||||
|
result = terminate_instances(self.context, ['i-00000001'])
|
||||||
|
self.assertTrue(result)
|
||||||
|
# non-existing instance_id
|
||||||
|
self.assertRaises(exception.InstanceNotFound, terminate_instances,
|
||||||
|
self.context, ['i-2'])
|
||||||
|
db.instance_destroy(self.context, inst1['id'])
|
||||||
|
|
||||||
def test_update_of_instance_display_fields(self):
|
def test_update_of_instance_display_fields(self):
|
||||||
inst = db.instance_create(self.context, {})
|
inst = db.instance_create(self.context, {})
|
||||||
ec2_id = ec2utils.id_to_ec2_id(inst['id'])
|
ec2_id = ec2utils.id_to_ec2_id(inst['id'])
|
||||||
|
|||||||
Reference in New Issue
Block a user