← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~powersj/cloud-init:fix-test-mkfs into cloud-init:master

 

Joshua Powers has proposed merging ~powersj/cloud-init:fix-test-mkfs into cloud-init:master.

Commit message:
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

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/324201
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~powersj/cloud-init:fix-test-mkfs into cloud-init:master.
diff --git a/tests/unittests/test_handler/test_handler_disk_setup.py b/tests/unittests/test_handler/test_handler_disk_setup.py
index 68fc6aa..f5072e9 100644
--- a/tests/unittests/test_handler/test_handler_disk_setup.py
+++ b/tests/unittests/test_handler/test_handler_disk_setup.py
@@ -3,6 +3,7 @@
 import random
 
 from cloudinit.config import cc_disk_setup
+from cloudinit import util
 from ..helpers import ExitStack, mock, TestCase
 
 
@@ -213,8 +214,9 @@ class TestMkfsCommandHandling(TestCase):
             'overwrite': True
         })
 
+        MKFS_EXT4_CMD = util.which("mkfs.ext4")
         subp.assert_called_once_with(
-            ['/sbin/mkfs.ext4', '/dev/xdb1',
+            [MKFS_EXT4_CMD, '/dev/xdb1',
              '-L', 'without_cmd', '-F', 'are', 'added'],
             shell=False)
 

Follow ups