Merge lp:~rvb/maas/fix-spurious-test-failure into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 4130
Proposed branch: lp:~rvb/maas/fix-spurious-test-failure
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 15 lines (+3/-2)
1 file modified
src/maasserver/models/tests/test_node.py (+3/-2)
To merge this branch: bzr merge lp:~rvb/maas/fix-spurious-test-failure
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
Review via email: mp+265634@code.launchpad.net

Commit message

Fix spurious test failure: explicitly sort the MACs in the tests.

Description of the change

Note that I haven't been able to reproduce the spurious failure that happened when landing a branch but I figured the sorting needed to be explicit for the first node to get picked up correctly.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/tests/test_node.py'
2--- src/maasserver/models/tests/test_node.py 2015-07-21 21:14:48 +0000
3+++ src/maasserver/models/tests/test_node.py 2015-07-23 10:50:51 +0000
4@@ -2059,8 +2059,9 @@
5
6 def test_get_pxe_mac_returns_first_macaddress_if_pxe_mac_unset(self):
7 node = factory.make_Node(mac=True)
8- factory.make_MACAddress(node=node)
9- self.assertEqual(node.macaddress_set.first(), node.get_pxe_mac())
10+ [factory.make_MACAddress(node=node) for _ in range(3)]
11+ self.assertEqual(
12+ node.macaddress_set.order_by('id').first(), node.get_pxe_mac())
13
14 def test_pxe_mac_deletion_does_not_delete_node(self):
15 node = factory.make_Node(mac=True)