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
=== modified file 'bin/nova-dhcpbridge'
--- bin/nova-dhcpbridge 2010-10-14 06:44:04 +0000
+++ bin/nova-dhcpbridge 2010-10-15 19:53:40 +0000
@@ -42,7 +42,6 @@
4242
43FLAGS = flags.FLAGS43FLAGS = flags.FLAGS
44flags.DECLARE('auth_driver', 'nova.auth.manager')44flags.DECLARE('auth_driver', 'nova.auth.manager')
45flags.DECLARE('redis_db', 'nova.datastore')
46flags.DECLARE('network_size', 'nova.network.manager')45flags.DECLARE('network_size', 'nova.network.manager')
47flags.DECLARE('num_networks', 'nova.network.manager')46flags.DECLARE('num_networks', 'nova.network.manager')
48flags.DECLARE('update_dhcp_on_disassociate', 'nova.network.manager')47flags.DECLARE('update_dhcp_on_disassociate', 'nova.network.manager')
@@ -100,11 +99,10 @@
100 interface = os.environ.get('DNSMASQ_INTERFACE', 'br0')99 interface = os.environ.get('DNSMASQ_INTERFACE', 'br0')
101 if int(os.environ.get('TESTING', '0')):100 if int(os.environ.get('TESTING', '0')):
102 FLAGS.fake_rabbit = True101 FLAGS.fake_rabbit = True
103 FLAGS.redis_db = 8
104 FLAGS.network_size = 16102 FLAGS.network_size = 16
105 FLAGS.connection_type = 'fake'103 FLAGS.connection_type = 'fake'
106 FLAGS.fake_network = True104 FLAGS.fake_network = True
107 FLAGS.auth_driver = 'nova.auth.ldapdriver.FakeLdapDriver'105 FLAGS.auth_driver = 'nova.auth.dbdriver.DbDriver'
108 FLAGS.num_networks = 5106 FLAGS.num_networks = 5
109 path = os.path.abspath(os.path.join(os.path.dirname(__file__),107 path = os.path.abspath(os.path.join(os.path.dirname(__file__),
110 '..',108 '..',
111109
=== modified file 'nova/tests/cloud_unittest.py'
--- nova/tests/cloud_unittest.py 2010-10-14 04:42:10 +0000
+++ nova/tests/cloud_unittest.py 2010-10-15 19:53:40 +0000
@@ -26,6 +26,7 @@
26import tempfile26import tempfile
27import time27import time
2828
29from eventlet import greenthread
29from twisted.internet import defer30from twisted.internet import defer
30import unittest31import unittest
31from xml.etree import ElementTree32from xml.etree import ElementTree
@@ -101,6 +102,9 @@
101 instance_id = rv['instancesSet'][0]['instanceId']102 instance_id = rv['instancesSet'][0]['instanceId']
102 output = yield self.cloud.get_console_output(context=self.context, instance_id=[instance_id])103 output = yield self.cloud.get_console_output(context=self.context, instance_id=[instance_id])
103 self.assertEquals(b64decode(output['output']), 'FAKE CONSOLE OUTPUT')104 self.assertEquals(b64decode(output['output']), 'FAKE CONSOLE OUTPUT')
105 # TODO(soren): We need this until we can stop polling in the rpc code
106 # for unit tests.
107 greenthread.sleep(0.3)
104 rv = yield self.cloud.terminate_instances(self.context, [instance_id])108 rv = yield self.cloud.terminate_instances(self.context, [instance_id])
105109
106110