[blivet:f21-branch 13/14] Add a test for activation.

mulhern amulhern at redhat.com
Mon Sep 29 17:23:00 UTC 2014


---
 tests/devicelibs_test/mdraid_test.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/devicelibs_test/mdraid_test.py b/tests/devicelibs_test/mdraid_test.py
index 0daa56e..e6fdf55 100755
--- a/tests/devicelibs_test/mdraid_test.py
+++ b/tests/devicelibs_test/mdraid_test.py
@@ -155,6 +155,8 @@ class SimpleRaidTest(MDRaidAsRootTestCase):
         with self.assertRaises(MDRaidError):
             mdraid.mdnominate(self.loopDevices[2])
 
+        info_pre = mdraid.mddetail(self._dev_name)
+
         ##
         ## mddeactivate
         ##
@@ -182,6 +184,23 @@ class SimpleRaidTest(MDRaidAsRootTestCase):
         with self.assertRaises(MDRaidError):
             mdraid.mdactivate("/dev/md1")
 
+        self.assertIsNone(mdraid.mdactivate(self._dev_name, array_uuid=info_pre['UUID']))
+        time.sleep(2)
+        info_post = mdraid.mddetail(self._dev_name)
+
+        # the array should remain mostly the same across activations
+        changeable_values = (
+           'ACTIVE DEVICES',
+           'STATE',
+           'TOTAL DEVICES',
+           'WORKING DEVICES'
+        )
+        for k in (k for k in info_pre.keys() if k not in changeable_values):
+            self.assertEqual(info_pre[k], info_post[k], msg="key: %s" % k)
+
+        # deactivating the array one more time
+        self.assertIsNone(mdraid.mddeactivate(self._dev_name))
+
         ##
         ## mddestroy
         ##
-- 
1.9.3



More information about the anaconda-patches mailing list