← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/wrong-interface into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/wrong-interface into lp:maas.

Commit message:
Fix spurious test failure: test arbitrarily picked nodegroup.nodegroupinterfaces_set[0] where there were 2 without a specified order.  Test probably predated the creation of a default nodegroupinterface before the nodegroup's dhcp settings were initialized; at the time it must have been obvious that there'd be only 1.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/wrong-interface/+merge/129615

Discussed with Raphael, who spotted the test failure.  Failure output is here: https://jenkins.qa.ubuntu.com/job/maas-trunk/1029/console

This does raise the question: when we initialize DHCP settings on a nodegroup, should we remove any previously created default nodegroupinterface?


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/wrong-interface/+merge/129615
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/wrong-interface into lp:maas.
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py	2012-10-11 13:41:57 +0000
+++ src/maasserver/tests/test_api.py	2012-10-15 08:00:30 +0000
@@ -3276,7 +3276,7 @@
             (parsed_result, NodeGroup.objects.ensure_master().uuid))
 
     def test_register_nodegroup_configures_master_if_unconfigured(self):
-        name = factory.make_name('name')
+        name = factory.make_name('nodegroup')
         uuid = factory.getRandomUUID()
         interface = make_interface_settings()
         self.client.post(
@@ -3289,7 +3289,8 @@
             })
         master = NodeGroup.objects.ensure_master()
         self.assertThat(
-            master.nodegroupinterface_set.all()[0],
+            master.nodegroupinterface_set.get(
+                interface=interface['interface']),
             MatchesStructure.byEquality(**interface))
         self.assertEqual(NODEGROUP_STATUS.ACCEPTED, master.status)