3187bc
From c495f74951caa0104636032e00704a83ab5f73b1 Mon Sep 17 00:00:00 2001
3187bc
From: Vojtech Trefny <vtrefny@redhat.com>
3187bc
Date: Tue, 26 Mar 2019 12:58:53 +0100
3187bc
Subject: [PATCH 1/3] Properly clean after availability test case
3187bc
3187bc
We need to set availability of the 'mkfs.hfsplus' utility back to
3187bc
it's real value after changing it to "always available" for this
3187bc
test case.
3187bc
---
3187bc
 tests/devices_test/dependencies_test.py | 3 +++
3187bc
 1 file changed, 3 insertions(+)
3187bc
3187bc
diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
3187bc
index 9dbdd24d..76bf758b 100644
3187bc
--- a/tests/devices_test/dependencies_test.py
3187bc
+++ b/tests/devices_test/dependencies_test.py
3187bc
@@ -69,6 +69,7 @@ class MockingDeviceDependenciesTestCase1(unittest.TestCase):
3187bc
 
3187bc
         self.mdraid_method = availability.BLOCKDEV_MDRAID_PLUGIN._method
3187bc
         self.dm_method = availability.BLOCKDEV_DM_PLUGIN._method
3187bc
+        self.hfsplus_method = availability.MKFS_HFSPLUS_APP._method
3187bc
         self.cache_availability = availability.CACHE_AVAILABILITY
3187bc
 
3187bc
         self.addCleanup(self._clean_up)
3187bc
@@ -105,10 +106,12 @@ class MockingDeviceDependenciesTestCase1(unittest.TestCase):
3187bc
     def _clean_up(self):
3187bc
         availability.BLOCKDEV_MDRAID_PLUGIN._method = self.mdraid_method
3187bc
         availability.BLOCKDEV_DM_PLUGIN._method = self.dm_method
3187bc
+        availability.MKFS_HFSPLUS_APP._method = self.hfsplus_method
3187bc
 
3187bc
         availability.CACHE_AVAILABILITY = False
3187bc
         availability.BLOCKDEV_MDRAID_PLUGIN.available  # pylint: disable=pointless-statement
3187bc
         availability.BLOCKDEV_DM_PLUGIN.available  # pylint: disable=pointless-statement
3187bc
+        availability.MKFS_HFSPLUS_APP.available  # pylint: disable=pointless-statement
3187bc
 
3187bc
         availability.CACHE_AVAILABILITY = self.cache_availability
3187bc
 
3187bc
-- 
3187bc
2.20.1
3187bc
3187bc
3187bc
From a6798882f5ba5b1e0ea655255d6f1fd5eda85f64 Mon Sep 17 00:00:00 2001
3187bc
From: Vojtech Trefny <vtrefny@redhat.com>
3187bc
Date: Tue, 26 Mar 2019 13:00:40 +0100
3187bc
Subject: [PATCH 2/3] Skip weak dependencies test if we don't have all
3187bc
 libblockdev plugins
3187bc
3187bc
This test checks that creating devices works when we have all
3187bc
plugins and fails "nicely" if we don't have all plugins so we
3187bc
actually need all the plugins for this test case.
3187bc
---
3187bc
 tests/devices_test/dependencies_test.py | 5 +++++
3187bc
 1 file changed, 5 insertions(+)
3187bc
3187bc
diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
3187bc
index 76bf758b..308d6192 100644
3187bc
--- a/tests/devices_test/dependencies_test.py
3187bc
+++ b/tests/devices_test/dependencies_test.py
3187bc
@@ -157,6 +157,11 @@ class MissingWeakDependenciesTestCase(unittest.TestCase):
3187bc
         self.disk1_file = create_sparse_tempfile("disk1", Size("2GiB"))
3187bc
         self.plugins = blockdev.plugin_specs_from_names(blockdev.get_available_plugin_names())
3187bc
 
3187bc
+        loaded_plugins = self.load_all_plugins()
3187bc
+        if not all(p in loaded_plugins for p in ("btrfs", "crypto", "lvm", "md")):
3187bc
+            # we don't have all plugins needed for this test case
3187bc
+            self.skipTest("Missing libblockdev plugins needed from weak dependencies test.")
3187bc
+
3187bc
     def _clean_up(self):
3187bc
         # reload all libblockdev plugins
3187bc
         self.load_all_plugins()
3187bc
-- 
3187bc
2.20.1
3187bc
3187bc
3187bc
From 151fce2c9a98dc5a7943b314828518518a755ec8 Mon Sep 17 00:00:00 2001
3187bc
From: Vojtech Trefny <vtrefny@redhat.com>
3187bc
Date: Tue, 26 Mar 2019 13:36:31 +0100
3187bc
Subject: [PATCH 3/3] Check for format tools availability in action_test
3187bc
3187bc
---
3187bc
 tests/action_test.py | 16 ++++++++++++++++
3187bc
 1 file changed, 16 insertions(+)
3187bc
3187bc
diff --git a/tests/action_test.py b/tests/action_test.py
3187bc
index 93ed9e57..101d5a21 100644
3187bc
--- a/tests/action_test.py
3187bc
+++ b/tests/action_test.py
3187bc
@@ -19,6 +19,13 @@ from blivet.devices import MDRaidArrayDevice
3187bc
 from blivet.devices import LVMVolumeGroupDevice
3187bc
 from blivet.devices import LVMLogicalVolumeDevice
3187bc
 
3187bc
+# format classes
3187bc
+from blivet.formats.fs import Ext2FS
3187bc
+from blivet.formats.fs import Ext3FS
3187bc
+from blivet.formats.fs import Ext4FS
3187bc
+from blivet.formats.fs import FATFS
3187bc
+from blivet.formats.fs import XFS
3187bc
+
3187bc
 # action classes
3187bc
 from blivet.deviceaction import ActionCreateDevice
3187bc
 from blivet.deviceaction import ActionResizeDevice
3187bc
@@ -39,8 +46,17 @@ DEVICE_CLASSES = [
3187bc
     LVMLogicalVolumeDevice
3187bc
 ]
3187bc
 
3187bc
+FORMAT_CLASSES = [
3187bc
+    Ext2FS,
3187bc
+    Ext3FS,
3187bc
+    Ext4FS,
3187bc
+    FATFS,
3187bc
+    XFS
3187bc
+]
3187bc
+
3187bc
 
3187bc
 @unittest.skipUnless(not any(x.unavailable_type_dependencies() for x in DEVICE_CLASSES), "some unsupported device classes required for this test")
3187bc
+@unittest.skipUnless(not any(x().utils_available for x in FORMAT_CLASSES), "some unsupported format classes required for this test")
3187bc
 class DeviceActionTestCase(StorageTestCase):
3187bc
 
3187bc
     """ DeviceActionTestSuite """
3187bc
-- 
3187bc
2.20.1
3187bc