Merge lp:~soren/nova/fix-unit-tests into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Eric Day
Approved revision: 315
Merged at revision: 356
Proposed branch: lp:~soren/nova/fix-unit-tests
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 44 lines (+5/-3)
2 files modified
bin/nova-dhcpbridge (+1/-3)
nova/tests/cloud_unittest.py (+4/-0)
To merge this branch: bzr merge lp:~soren/nova/fix-unit-tests
Reviewer Review Type Date Requested Status
Eric Day (community) Approve
Jay Pipes (community) Approve
Review via email: mp+38587@code.launchpad.net

Description of the change

Fix some unit tests:
 * One is a race due to the polling nature of rpc in eventlet based unit tests.
 * The other is a more real problem. It was caused by datastore.py being removed. It wasn't caught earlier because the .pyc file was still around on the tarmac box.

To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

nice catches.

review: Approve
Revision history for this message
Eric Day (eday) wrote :

not pretty, but as we discussed in IRC, good for now. :)

review: Approve
Revision history for this message
Michael Gundlach (gundlach) wrote :

Maybe we should find . -name *.pyc | xargs rm -rf before we run tarmac
tests?

Michael

On Fri, Oct 15, 2010 at 3:53 PM, Soren Hansen <email address hidden> wrote:

> Soren Hansen has proposed merging lp:~soren/nova/fix-unit-tests into
> lp:nova.
>
> Requested reviews:
> Nova Core (nova-core)
>
>
> Fix some unit tests:
> * One is a race due to the polling nature of rpc in eventlet based unit
> tests.
> * The other is a more real problem. It was caused by datastore.py being
> removed. It wasn't caught earlier because the .pyc file was still around on
> the tarmac box.
> --
> https://code.launchpad.net/~soren/nova/fix-unit-tests/+merge/38587
> Your team Nova Core is requested to review the proposed merge of
> lp:~soren/nova/fix-unit-tests into lp:nova.
>

Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at <email address hidden>, and delete the original message.
Your cooperation is appreciated.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/nova-dhcpbridge'
2--- bin/nova-dhcpbridge 2010-10-14 06:44:04 +0000
3+++ bin/nova-dhcpbridge 2010-10-15 19:53:40 +0000
4@@ -42,7 +42,6 @@
5
6 FLAGS = flags.FLAGS
7 flags.DECLARE('auth_driver', 'nova.auth.manager')
8-flags.DECLARE('redis_db', 'nova.datastore')
9 flags.DECLARE('network_size', 'nova.network.manager')
10 flags.DECLARE('num_networks', 'nova.network.manager')
11 flags.DECLARE('update_dhcp_on_disassociate', 'nova.network.manager')
12@@ -100,11 +99,10 @@
13 interface = os.environ.get('DNSMASQ_INTERFACE', 'br0')
14 if int(os.environ.get('TESTING', '0')):
15 FLAGS.fake_rabbit = True
16- FLAGS.redis_db = 8
17 FLAGS.network_size = 16
18 FLAGS.connection_type = 'fake'
19 FLAGS.fake_network = True
20- FLAGS.auth_driver = 'nova.auth.ldapdriver.FakeLdapDriver'
21+ FLAGS.auth_driver = 'nova.auth.dbdriver.DbDriver'
22 FLAGS.num_networks = 5
23 path = os.path.abspath(os.path.join(os.path.dirname(__file__),
24 '..',
25
26=== modified file 'nova/tests/cloud_unittest.py'
27--- nova/tests/cloud_unittest.py 2010-10-14 04:42:10 +0000
28+++ nova/tests/cloud_unittest.py 2010-10-15 19:53:40 +0000
29@@ -26,6 +26,7 @@
30 import tempfile
31 import time
32
33+from eventlet import greenthread
34 from twisted.internet import defer
35 import unittest
36 from xml.etree import ElementTree
37@@ -101,6 +102,9 @@
38 instance_id = rv['instancesSet'][0]['instanceId']
39 output = yield self.cloud.get_console_output(context=self.context, instance_id=[instance_id])
40 self.assertEquals(b64decode(output['output']), 'FAKE CONSOLE OUTPUT')
41+ # TODO(soren): We need this until we can stop polling in the rpc code
42+ # for unit tests.
43+ greenthread.sleep(0.3)
44 rv = yield self.cloud.terminate_instances(self.context, [instance_id])
45
46