Merge lp:~gmb/maas/fix-my-stupidity into lp:~maas-committers/maas/trunk
Status: | Merged |
---|---|
Approved by: | Graham Binns |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2508 |
Proposed branch: | lp:~gmb/maas/fix-my-stupidity |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
175 lines (+77/-65) 2 files modified
src/maasserver/models/nodegroupinterface.py (+65/-59) src/maasserver/models/tests/test_nodegroupinterface.py (+12/-6) |
To merge this branch: | bzr merge lp:~gmb/maas/fix-my-stupidity |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+225516@code.launchpad.net |
Commit message
Fix TestNodeGroupIn
so that it no longer uses factory.
Description of the change
Fix TestNodeGroupIn
so that it no longer uses factory.
make_ip_range() makes no guarantees about the size of the range, other
than that the lower bound will be lower than the upper. So it was
possible for the returned IP range to span only two addresses, which
meant that when test_clean_
the lowest address in the range and subtracted 1 from the highest - in
order to definte a range within a range - it would end up just reversing
the bounds.
To fix this, I've made test_clean_
just use get_random_
which returns a network with a minimum size of 8.
Yup, that should do it. Maybe make_ip_range should take a "minimum size" argument, too, but that would be harder to implement I suppose.
By the way, clean_ip_ranges looks as if it could be a lot prettier if it just started with "if I have nothing to do here, return right away."