Merge lp:~jtv/maas-test/extract-fixtures into lp:maas-test
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jeroen T. Vermeulen | ||||
Approved revision: | 121 | ||||
Merged at revision: | 119 | ||||
Proposed branch: | lp:~jtv/maas-test/extract-fixtures | ||||
Merge into: | lp:maas-test | ||||
Diff against target: |
474 lines (+235/-100) 5 files modified
maastest/cases.py (+11/-38) maastest/main.py (+106/-57) maastest/script.py (+31/-0) maastest/tests/test_main.py (+85/-3) setup.py (+2/-2) |
||||
To merge this branch: | bzr merge lp:~jtv/maas-test/extract-fixtures | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Needs Fixing | ||
Graham Binns (community) | Approve | ||
Review via email: mp+201185@code.launchpad.net |
Commit message
Move proxy/kvm fixtures from test-case class to main().
Description of the change
This is needed in order to be able to perform a second check for unexpected DHCP servers inside the virtual machine. As long as the virtual machine is a fixture in the test case, we can only perform that check inside the test case, where a failure gets misinterpreted as a test failure. When I tried that with a DHCP server running on my network, deliberately causing it to fail, the code even tried to report the fact to Launchpad!
The proxy comes along with the KVMFixture, because the latter needs to know the former. Now, only the MAAS fixture is left inside the test case. That makes a bit more sense, I suppose — a failure to set up the MAAS might be worth reporting. But the purpose of this branch is not to clean up in general, but to pave the way for the extra DHCP check. It will be very easy with these changes in place.
The import style in main.py started getting in the way of unit-testing: it gets awkward to patch() items that are only imported inside a function. But as far as I can see, by far the greatest benefit of late imports was to maintain responsiveness when the user calls maas-test with --help, or makes some basic mistake in usage. I resolved that by creating a new, dedicated little module for the entry point. That's where most of the late imports now happen; once you're past command-line parsing it's OK to do a bit more work.
Jeroen
You're a brilliant — if slightly disturbing — man and this is good stuff.
It does have conflicts, but then so does great drama. Fix those and all is happiness and ponies.