From e4885db8668227ccf7640576c35e5761729cb7cf Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Fri, 27 Oct 2023 14:29:40 +0200 Subject: [PATCH] Adjust test_mount_filesystems to the latest blivet changes The next version of blivet will switch from calling the 'mount' command for mounting to libblockdev FS plugin (which use libmount) so the test needs to be changed. This way the check will work with both the old and the new blivet's code. Related: https://github.com/storaged-project/blivet/pull/1163 (cherry picked from commit 5cffb0caf936f96319acd55c8801a3cdc14ec406) --- .../modules/storage/test_module_storage.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py index 4cc3f262588..415f6c9f821 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py @@ -1548,29 +1548,26 @@ def test_activate_filesystems(self, patched_conf): @patch("os.chmod") @patch("os.makedirs") - @patch("blivet.util._run_program") + @patch("blivet.tasks.fsmount.FSMount.do_task") @patch("pyanaconda.core.util._run_program") - def test_mount_filesystems(self, core_run_program, blivet_run_program, makedirs, chmod): + def test_mount_filesystems(self, core_run_program, blivet_mount, makedirs, chmod): """Test MountFilesystemsTask.""" storage = create_storage() storage._bootloader = Mock() - blivet_run_program.return_value = (0, "") + blivet_mount.return_value = None core_run_program.return_value = (0, "") task = MountFilesystemsTask(storage) task.run() # created mount points - makedirs.assert_any_call('/mnt/sysimage/dev', 0o755) makedirs.assert_any_call('/mnt/sysimage/tmp') # fixed permissions chmod.assert_any_call('/mnt/sysimage/tmp', 0o1777) # mounted devices - blivet_run_program.assert_any_call([ - 'mount', '-t', 'bind', '-o', 'bind,defaults', '/dev', '/mnt/sysimage/dev' - ]) + blivet_mount.assert_any_call('/mnt/sysimage/dev', options='defaults') # remounted the root filesystem core_run_program.assert_any_call(