diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2014-10-17 12:32:41 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2014-10-17 12:32:41 -0700 |
commit | 8eedba0d3b9851bb0101407c5a070b7a975efa04 (patch) | |
tree | 50d3a70edf18b1244b76bd5d45b1b21a89776ffa /tests | |
parent | 797de394e5395f39b7f17403999e25cbe7f7a126 (diff) | |
download | vyos-cloud-init-8eedba0d3b9851bb0101407c5a070b7a975efa04.tar.gz vyos-cloud-init-8eedba0d3b9851bb0101407c5a070b7a975efa04.zip |
Expose uses_systemd as a distro function
Without this change the tests are currently failing on rhel7
since a location where a hostname file is written no longer
exists at that location when systemd is active. To avoid this
allow the test to inspect if the distro has systemd enabled
and avoid testing the file when systemd is being used so the
test passes.
We likely need to figure out a better way to test features
that no longer exist as files but exist as commands with
systemd in general.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/test_handler/test_handler_set_hostname.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/unittests/test_handler/test_handler_set_hostname.py b/tests/unittests/test_handler/test_handler_set_hostname.py index 03004ab9..e1530e30 100644 --- a/tests/unittests/test_handler/test_handler_set_hostname.py +++ b/tests/unittests/test_handler/test_handler_set_hostname.py @@ -37,10 +37,11 @@ class TestHostname(t_help.FilesystemMockingTestCase): self.patchUtils(self.tmp) cc_set_hostname.handle('cc_set_hostname', cfg, cc, LOG, []) - contents = util.load_file("/etc/sysconfig/network") - n_cfg = ConfigObj(StringIO(contents)) - self.assertEquals({'HOSTNAME': 'blah.blah.blah.yahoo.com'}, - dict(n_cfg)) + if not distro.uses_systemd(): + contents = util.load_file("/etc/sysconfig/network") + n_cfg = ConfigObj(StringIO(contents)) + self.assertEquals({'HOSTNAME': 'blah.blah.blah.yahoo.com'}, + dict(n_cfg)) def test_write_hostname_debian(self): cfg = { |