Merge lp:~usc-isi/nova/lp796820 into lp:~hudson-openstack/nova/trunk

Proposed by Lorin Hochstein
Status: Merged
Approved by: Mark Washenberger
Approved revision: 1178
Merged at revision: 1187
Proposed branch: lp:~usc-isi/nova/lp796820
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 25 lines (+7/-1)
1 file modified
nova/tests/test_cloud.py (+7/-1)
To merge this branch: bzr merge lp:~usc-isi/nova/lp796820
Reviewer Review Type Date Requested Status
Mark Washenberger (community) Approve
Brian Waldon (community) Approve
Trey Morris (community) Needs Fixing
Review via email: mp+64457@code.launchpad.net

Description of the change

Fixes a bug where a unit test sometimes fails due to a race condition.

To post a comment you must log in.
Revision history for this message
Ed Leafe (ed-leafe) wrote :

Would it be better to stub out the rpc call? Unit tests shouldn't be dependent on externals like this.

Revision history for this message
Trey Morris (tr3buchet) wrote :

sneaky good fix, but I agree with ed: that call should be stubbed out.

review: Needs Fixing
Revision history for this message
Lorin Hochstein (lorinh) wrote :

I'll stub it out and re-submit the merge prop.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

Setting to WIP for now. Lorin, you can set back to Needs Review when you're ready.

Revision history for this message
Lorin Hochstein (lorinh) wrote :

It's ready now.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

Good work.

review: Approve
Revision history for this message
Mark Washenberger (markwash) wrote :

Looks good. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/tests/test_cloud.py'
--- nova/tests/test_cloud.py 2011-06-10 18:10:58 +0000
+++ nova/tests/test_cloud.py 2011-06-14 17:23:59 +0000
@@ -457,6 +457,12 @@
457 self.cloud.delete_key_pair(self.context, 'test')457 self.cloud.delete_key_pair(self.context, 'test')
458458
459 def test_run_instances(self):459 def test_run_instances(self):
460 # stub out the rpc call
461 def stub_cast(*args, **kwargs):
462 pass
463
464 self.stubs.Set(rpc, 'cast', stub_cast)
465
460 kwargs = {'image_id': FLAGS.default_image,466 kwargs = {'image_id': FLAGS.default_image,
461 'instance_type': FLAGS.default_instance_type,467 'instance_type': FLAGS.default_instance_type,
462 'max_count': 1}468 'max_count': 1}
@@ -466,7 +472,7 @@
466 self.assertEqual(instance['imageId'], 'ami-00000001')472 self.assertEqual(instance['imageId'], 'ami-00000001')
467 self.assertEqual(instance['displayName'], 'Server 1')473 self.assertEqual(instance['displayName'], 'Server 1')
468 self.assertEqual(instance['instanceId'], 'i-00000001')474 self.assertEqual(instance['instanceId'], 'i-00000001')
469 self.assertEqual(instance['instanceState']['name'], 'networking')475 self.assertEqual(instance['instanceState']['name'], 'scheduling')
470 self.assertEqual(instance['instanceType'], 'm1.small')476 self.assertEqual(instance['instanceType'], 'm1.small')
471477
472 def test_run_instances_image_state_none(self):478 def test_run_instances_image_state_none(self):