Merge lp:~rvb/maas-test/import-images-api into lp:maas-test
Proposed by
Raphaël Badin
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Raphaël Badin | ||||
Approved revision: | 152 | ||||
Merged at revision: | 147 | ||||
Proposed branch: | lp:~rvb/maas-test/import-images-api | ||||
Merge into: | lp:maas-test | ||||
Diff against target: |
172 lines (+83/-1) 2 files modified
maastest/maasfixture.py (+28/-0) maastest/tests/test_maasfixture.py (+55/-1) |
||||
To merge this branch: | bzr merge lp:~rvb/maas-test/import-images-api | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+214913@code.launchpad.net |
Commit message
No node can be booted until the boot images have been reported back to the region: wait until the report_boot_images task has populated the BootImage table.
Description of the change
I've tested this change, with success, in the lab: http://
To post a comment you must log in.
Thanks for fixing this — and let's not forget, diagnosing it!
Notes as usual:
Maybe in the docstring for wait_until_ boot_images_ scanned, say “until the master cluster has reported boot images” (so as not to give the impression that we just wait for them to appear in /var/lib/maas)?
.
Any particular reason why wait_until_ boot_images_ scanned returns the number of images? It seems a bit arbitrary (why not the actual list, for instance?) and introduces testing for something that's not actually used. Why not just return nothing, and document the fact that either a timeout or a failure to request the listing will raise an exception?
By the way, the initial assignment for nb_images looks dead to me.
.
Also in wait_until_ boot_images_ scanned, it turns out that RuntimeError isn't really for this kind of error, but rather for errors originating in the Python runtime. And, it's deprecated anyway. Better derive an ad-hoc exception class from Exception.
The exception's error message says “cluster” instead of “the cluster,” which makes it look a little weird to me. But maybe it would be more helpful to say e.g. “Boot image download timed out: cluster reported no images”?
.
In test_maasfixtur e.py, I wonder if it would make sense to make the patch for wait_until_ boot_images_ scanned a standard part of make_maas_fixture, with an option to skip it?
.
What's going on with the separate make_kvm_fixture steps? AFAIK you don't need to do that — just call make_maas_fixture and it will create a KVMFixture for you. In test_list_ boot_images_ lists_images there's even a commented-out line that did it that way. Is there a difference? Or was this a transient change during development that is no longer needed?
.
Setup gets a little lengthy in test_list_ boot_images_ lists_images. Might it make sense to extract this bit into a helper?
uuid = self.getUniqueS tring()
maas_ fixture, 'get_master_ ng_uuid' ,
mock. MagicMock( return_ value=uuid) )
self.patch(