diff options
| author | Lorin Hochstein <lorin@isi.edu> | 2011-06-14 13:14:00 -0400 |
|---|---|---|
| committer | Lorin Hochstein <lorin@isi.edu> | 2011-06-14 13:14:00 -0400 |
| commit | b44dfde77b501e7c0d84769cab3b4a1a317c738d (patch) | |
| tree | ebf7d5948f4a63d063456d0aae17fc83373a4542 | |
| parent | 2f422747cc7ffcbbe952e9a3fb5fd1de6a417901 (diff) | |
Stub out the rpc call in a unit test to avoid a race condition
| -rw-r--r-- | nova/tests/test_cloud.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py index b491448eb..afc661635 100644 --- a/nova/tests/test_cloud.py +++ b/nova/tests/test_cloud.py @@ -457,6 +457,12 @@ class CloudTestCase(test.TestCase): self.cloud.delete_key_pair(self.context, 'test') def test_run_instances(self): + # stub out the rpc call + def stub_cast(*args, **kwargs): + pass + + self.stubs.Set(rpc, 'cast', stub_cast) + kwargs = {'image_id': FLAGS.default_image, 'instance_type': FLAGS.default_instance_type, 'max_count': 1} @@ -466,8 +472,7 @@ class CloudTestCase(test.TestCase): self.assertEqual(instance['imageId'], 'ami-00000001') self.assertEqual(instance['displayName'], 'Server 1') self.assertEqual(instance['instanceId'], 'i-00000001') - self.assertTrue(instance['instanceState']['name'] in - ['networking', 'scheduling']) + self.assertEqual(instance['instanceState']['name'], 'scheduling') self.assertEqual(instance['instanceType'], 'm1.small') def test_run_instances_image_state_none(self): |
