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