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
1=== modified file 'nova/tests/test_cloud.py'
2--- nova/tests/test_cloud.py 2011-06-10 18:10:58 +0000
3+++ nova/tests/test_cloud.py 2011-06-14 17:23:59 +0000
4@@ -457,6 +457,12 @@
5 self.cloud.delete_key_pair(self.context, 'test')
6
7 def test_run_instances(self):
8+ # stub out the rpc call
9+ def stub_cast(*args, **kwargs):
10+ pass
11+
12+ self.stubs.Set(rpc, 'cast', stub_cast)
13+
14 kwargs = {'image_id': FLAGS.default_image,
15 'instance_type': FLAGS.default_instance_type,
16 'max_count': 1}
17@@ -466,7 +472,7 @@
18 self.assertEqual(instance['imageId'], 'ami-00000001')
19 self.assertEqual(instance['displayName'], 'Server 1')
20 self.assertEqual(instance['instanceId'], 'i-00000001')
21- self.assertEqual(instance['instanceState']['name'], 'networking')
22+ self.assertEqual(instance['instanceState']['name'], 'scheduling')
23 self.assertEqual(instance['instanceType'], 'm1.small')
24
25 def test_run_instances_image_state_none(self):