merge with nova trunk
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
Tests For Compute
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import mox
|
||||
import stubout
|
||||
|
||||
@@ -84,7 +83,7 @@ class ComputeTestCase(test.TestCase):
|
||||
def _create_instance(self, params={}):
|
||||
"""Create a test instance"""
|
||||
inst = {}
|
||||
inst['image_id'] = 1
|
||||
inst['image_ref'] = 1
|
||||
inst['reservation_id'] = 'r-fakeres'
|
||||
inst['launch_time'] = '10'
|
||||
inst['user_id'] = self.user.id
|
||||
@@ -150,7 +149,7 @@ class ComputeTestCase(test.TestCase):
|
||||
ref = self.compute_api.create(
|
||||
self.context,
|
||||
instance_type=instance_types.get_default_instance_type(),
|
||||
image_id=None,
|
||||
image_href=None,
|
||||
security_group=['testgroup'])
|
||||
try:
|
||||
self.assertEqual(len(db.security_group_get_by_instance(
|
||||
@@ -168,7 +167,7 @@ class ComputeTestCase(test.TestCase):
|
||||
ref = self.compute_api.create(
|
||||
self.context,
|
||||
instance_type=instance_types.get_default_instance_type(),
|
||||
image_id=None,
|
||||
image_href=None,
|
||||
security_group=['testgroup'])
|
||||
try:
|
||||
db.instance_destroy(self.context, ref[0]['id'])
|
||||
@@ -184,7 +183,7 @@ class ComputeTestCase(test.TestCase):
|
||||
ref = self.compute_api.create(
|
||||
self.context,
|
||||
instance_type=instance_types.get_default_instance_type(),
|
||||
image_id=None,
|
||||
image_href=None,
|
||||
security_group=['testgroup'])
|
||||
|
||||
try:
|
||||
@@ -217,12 +216,12 @@ class ComputeTestCase(test.TestCase):
|
||||
instance_ref = db.instance_get(self.context, instance_id)
|
||||
self.assertEqual(instance_ref['launched_at'], None)
|
||||
self.assertEqual(instance_ref['deleted_at'], None)
|
||||
launch = datetime.datetime.utcnow()
|
||||
launch = utils.utcnow()
|
||||
self.compute.run_instance(self.context, instance_id)
|
||||
instance_ref = db.instance_get(self.context, instance_id)
|
||||
self.assert_(instance_ref['launched_at'] > launch)
|
||||
self.assertEqual(instance_ref['deleted_at'], None)
|
||||
terminate = datetime.datetime.utcnow()
|
||||
terminate = utils.utcnow()
|
||||
self.compute.terminate_instance(self.context, instance_id)
|
||||
self.context = self.context.elevated(True)
|
||||
instance_ref = db.instance_get(self.context, instance_id)
|
||||
|
||||
Reference in New Issue
Block a user