summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Powers <josh.powers@canonical.com>2017-05-17 10:33:00 -0700
committerScott Moser <smoser@brickies.net>2017-05-17 16:35:16 -0400
commit951863c211ab0f8c43a9443d080dbbe0f6b454a6 (patch)
treea7b2557f0b957d0a3e0cfa4cb44f13d2095aacaf
parent66e46d8ec290737fd74f50eb8c7672d627d9b516 (diff)
downloadvyos-cloud-init-951863c211ab0f8c43a9443d080dbbe0f6b454a6.tar.gz
vyos-cloud-init-951863c211ab0f8c43a9443d080dbbe0f6b454a6.zip
tests: fix hardcoded path to mkfs.ext4
A recent merge that added a mkfs.ext4 tests has a hard coded location for the binary of mkfs.ext4. On CentOS 7 the test failed because the command in a different location than Ubuntu. LP: #1691517
-rw-r--r--tests/unittests/test_handler/test_handler_disk_setup.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/unittests/test_handler/test_handler_disk_setup.py b/tests/unittests/test_handler/test_handler_disk_setup.py
index 68fc6aae..35dff3ee 100644
--- a/tests/unittests/test_handler/test_handler_disk_setup.py
+++ b/tests/unittests/test_handler/test_handler_disk_setup.py
@@ -202,9 +202,11 @@ class TestMkfsCommandHandling(TestCase):
subp.assert_called_once_with(
'mkfs -t ext4 -L with_cmd /dev/xdb1', shell=True)
- def test_overwrite_and_extra_opts_without_cmd(self, subp, *args):
+ @mock.patch('cloudinit.config.cc_disk_setup.util.which')
+ def test_overwrite_and_extra_opts_without_cmd(self, m_which, subp, *args):
"""mkfs observes extra_opts and overwrite settings when cmd is not
present."""
+ m_which.side_effect = lambda p: {'mkfs.ext4': '/sbin/mkfs.ext4'}[p]
cc_disk_setup.mkfs({
'filesystem': 'ext4',
'device': '/dev/xdb1',