On Mon, Apr 18, 2011 at 4:24 PM, anotherjesse <email address hidden> wrote:
> A unit test would be adding a test to nova/tests/test_compute.py that resulted in network_info being set and causing exceptions to occur until your patch is applied.
>
> Sometimes errors only really manifest in deployed systems (for which we have smoketests - a series of tests that run against the API of a deployed system).
>
> How did you happen upon the bug in the first place - that might help with determining how we can add a test :)
Although it may not be a good test, I've attached a test which fails
without my patch. Could you take a look?
Without my patch, the exception that happens beneath would be TypeError.
Hi Jesse,
On Mon, Apr 18, 2011 at 4:24 PM, anotherjesse <email address hidden> wrote: test_compute. py that resulted in network_info being set and causing exceptions to occur until your patch is applied.
> A unit test would be adding a test to nova/tests/
>
> Sometimes errors only really manifest in deployed systems (for which we have smoketests - a series of tests that run against the API of a deployed system).
>
> How did you happen upon the bug in the first place - that might help with determining how we can add a test :)
Although it may not be a good test, I've attached a test which fails
without my patch. Could you take a look?
Without my patch, the exception that happens beneath would be TypeError.
Thanks,
Yoshi
=== modified file 'nova/tests/ test_virt. py' test_virt. py 2011-04-07 21:48:29 +0000 test_virt. py 2011-04-19 08:42:23 +0000
db.volume_ destroy( self.context, volume_ref['id'])
db.instance_ destroy( self.context, instance_ref['id'])
--- nova/tests/
+++ nova/tests/
@@ -549,6 +549,44 @@
+ def test_spawn_ with_network_ info(self) : load_library_ exists( ): fake_libvirt_ mock() create( self.context, self.test_instance) ReplayAll( ) conn.LibvirtCon nection( False) driver. setattr( 'setup_ basic_filtering ', fake_none) driver. setattr( 'prepare_ instance_ filter' , fake_none) get_network( context. get_admin_ context( ), 'mac_address' ], instance, network_info) find('Unexpecte d method call')) (count)
self. manager. delete_ project( self.project)
self. manager. delete_ user(self. user)
+ # Skip if non-libvirt environment
+ if not self.lazy_
+ return
+
+ # Preparing mocks
+ def fake_none(self, instance):
+ return
+
+ self.create_
+ instance = db.instance_
+
+ # Start test
+ self.mox.
+ conn = libvirt_
+ conn.firewall_
+ conn.firewall_
+
+ network = db.project_
+ self.project.id)
+ ip_dict = {'ip': self.test_ip,
+ 'netmask': network['netmask'],
+ 'enabled': '1'}
+ mapping = {
+ 'label': network['label'],
+ 'gateway': network['gateway'],
+ 'mac': instance[
+ 'dns': [network['dns']],
+ 'ips': [ip_dict]}
+ network_info = [(network, mapping)]
+
+ try:
+ conn.spawn(
+ except Exception, e:
+ count = (0 <= e.message.
+
+ self.assertTrue
+
def tearDown(self):