Merge ~rjschwei/cloud-init:baseNetConfTestSUSE into cloud-init:master
| Status: | Merged |
|---|---|
| Approved by: | Scott Moser on 2017-12-21 |
| Approved revision: | 14a7b2e6d1a6ccdd488d1bf0b53fc5903d5e01cb |
| Merged at revision: | 25ddc98e8dcd37272825f7044cf4487e3ade126b |
| Proposed branch: | ~rjschwei/cloud-init:baseNetConfTestSUSE |
| Merge into: | cloud-init:master |
| Diff against target: |
84 lines (+46/-3) 1 file modified
tests/unittests/test_distros/test_netconfig.py (+46/-3) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Chad Smith | 2017-11-15 | Approve on 2017-12-20 | |
| Server Team CI bot | continuous-integration | Approve on 2017-12-09 | |
| cloud-init commiters | 2017-12-09 | Pending | |
|
Review via email:
|
|||
Description of the Change
It's a start a basic test for network configuration on openSUSE & SLES
FAILED: Continuous integration, rev:70a8e1d54ee
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
FAILED: MAAS Compatability Testing
Click here to trigger a rebuild:
https:/
| Chad Smith (chad.smith) wrote : | # |
man those exist stacks are stinking in that file. I would prefer if we could move more to either the wrap_and_call approach for handling multiple mock of FileSystemMocki
here's a pastebin of your test reworked with FilesystemMocki
http://
| Chad Smith (chad.smith) wrote : | # |
Thanks for this Robert, I marked it work in progress just so it pops back up to top of review queue when you get a chance to look over or respond my patch suggestion. I think longterm we'll do a bit of cleanup of all the nested mocks etc where possible and use eiter FileSystemMocki
Please just tick "Needs review' when this branch or discussion is ready for more eyes,
| Chad Smith (chad.smith) wrote : | # |
Also the Needs Fixing from CI is something that was fixed in master after this branch so a 'git fetch master' 'git rebase master' should fix that too.
| Robert Schweikert (rjschwei) wrote : | # |
Thanks Chad, and thanks for re-working the test, it is much nicer now.
PASSED: Continuous integration, rev:14a7b2e6d1a
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
SUCCESS: MAAS Compatability Testing
IN_PROGRESS: Declarative: Post Actions
Click here to trigger a rebuild:
https:/
| Scott Moser (smoser) wrote : | # |
I think if we re-factor the code just a bit we can make this much easier to test.
Heres an example:
http://
The result then is that we can test 'write_
tmpd = self.temp_dir()
devs = write_network_
self.assertEqu
There are some comments inline, but I think if you go this route its easier to get
test coverage.
| Robert Schweikert (rjschwei) wrote : | # |
Sorry, I think I am missing something in the bigger picture.
My goal was to add a basic test such that network configuration doesn't break again. This is/was intended to be a crutch until we can get openSUSE/SUSE moved to the sysconfig-renderer concept.
It is/was my impression that _write_network() is supposed to go away. Sorry but I am missing the point where using the method as a redirector moves us into the direction where _write_network() gets eliminated. But as I said maybe I am missing the bigger picture and _write_network() will live forever more, in which case I think we should drop the warning that is written to the log file if the code goes down that path.
Anyway, I am somewhat confused.
| Scott Moser (smoser) wrote : | # |
Robert,
I'm sorry for the confusion. I was reading this purely "on its own".
I think the re-factor makes it considerably easier to test, and thus is useful even if the point is only getting tests for somethign that will be replaced.
Chad pointed out to me that using the module level defines as defaults for the function call does not really make testing easier as those values not mockable. so consider this paste instead. Chad let me know if I understood you wrong.
| Chad Smith (chad.smith) wrote : | # |
Scott, understood. This refactor makes sense, we can do it either as a part of this branch landing, or you can point me at a trivial followup afterward that we can land right after


FAILED: Continuous integration, rev:8ac72b3d6c9 188114685c5e0ec dd84a23faf4dd5 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 496/
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
FAILED: MAAS Compatability Testing
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 496/rebuild
https:/