From 951863c211ab0f8c43a9443d080dbbe0f6b454a6 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Wed, 17 May 2017 10:33:00 -0700 Subject: 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 --- tests/unittests/test_handler/test_handler_disk_setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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', -- cgit v1.2.3