[blivet:master 3/7] Add a few small tests for mdexamine
mulhern
amulhern at redhat.com
Wed Jun 25 13:01:00 UTC 2014
Signed-off-by: mulhern <amulhern at redhat.com>
---
tests/devicelibs_test/mdraid_test.py | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tests/devicelibs_test/mdraid_test.py b/tests/devicelibs_test/mdraid_test.py
index cba8487..b9943d4 100755
--- a/tests/devicelibs_test/mdraid_test.py
+++ b/tests/devicelibs_test/mdraid_test.py
@@ -66,6 +66,11 @@ class MDRaidAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
super(MDRaidAsRootTestCase, self).tearDown()
+ def testNonMDRaid(self):
+ # invoking mdexamine on a device that is not an array member yields {}
+ info = mdraid.mdexamine(self.loopDevices[0])
+ self.assertEqual(info, {})
+
def testMDRaidAsRoot(self):
##
## mdcreate
@@ -75,6 +80,35 @@ class MDRaidAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
# wait for raid to settle
time.sleep(2)
+ info = mdraid.mdexamine(self._dev_name)
+ self.assertEqual(info, {})
+
+ info = mdraid.mdexamine(self.loopDevices[0])
+
+ names = [
+ 'DEVICE',
+ 'MD_ARRAY_SIZE',
+ 'MD_DEV_UUID',
+ 'MD_DEVICES',
+ 'MD_EVENTS',
+ 'MD_LEVEL',
+ 'MD_METADATA',
+ 'MD_NAME',
+ 'MD_UPDATE_TIME',
+ 'MD_UUID'
+ ]
+
+ # info contains values for exactly names
+ for n in names:
+ self.assertIn(n, info, msg="name '%s' not in info" % n)
+
+ for n in info.keys():
+ self.assertIn(n, names, msg="unexpected name '%s' in info" % n)
+
+ # check names with predictable values
+ self.assertEqual(info['MD_DEVICES'], '2')
+ self.assertEqual(info['MD_LEVEL'], 'raid1')
+
# fail
self.assertRaises(MDRaidError, mdraid.mdcreate, "/dev/md1", "raid1", ["/not/existing/dev0", "/not/existing/dev1"])
--
1.9.3
More information about the anaconda-patches
mailing list