Merge lp:~jtv/maas/fix-broken-make_denormalised_mac into lp:~maas-committers/maas/trunk

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 3043
Proposed branch: lp:~jtv/maas/fix-broken-make_denormalised_mac
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 17 lines (+1/-6)
1 file modified
src/metadataserver/deployment/tests/test_maas_configure_interfaces.py (+1/-6)
To merge this branch: bzr merge lp:~jtv/maas/fix-broken-make_denormalised_mac
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+235355@code.launchpad.net

Commit message

Fix make_denormalised_mac. Its workaround for the case where a random upper-cased MAC was accidentally normalised was broken.

Description of the change

Now that normalise_mac also strips whitespace, the solution is simple: add some whitespace and the result will always be denormalised.

This is urgent and near-trivial, so I think I'll just self-approve it before it breaks more tests.

Jeroen

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Looks OK. Self-approving. Sorry to those who wanted the cheap karma.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/metadataserver/deployment/tests/test_maas_configure_interfaces.py'
2--- src/metadataserver/deployment/tests/test_maas_configure_interfaces.py 2014-09-19 03:14:35 +0000
3+++ src/metadataserver/deployment/tests/test_maas_configure_interfaces.py 2014-09-20 03:59:01 +0000
4@@ -103,12 +103,7 @@
5
6 def make_denormalised_mac():
7 """Create a MAC address that is not in its normalised form."""
8- mac = factory.make_mac_address()
9- if mac.upper() == mac.lower():
10- # This is not denormalised. Inject an upper-case letter to ensure
11- # that we get something denormalised.
12- mac[-1] = 'D'
13- return mac.upper()
14+ return " %s " % factory.make_mac_address().upper()
15
16
17 class TestSplitIPPair(MAASTestCase):