Modify gnt-node add to call external script
[ganeti-local] / test / ganeti.utils_mlockall_unittest.py
index 654d518..17726b7 100755 (executable)
@@ -28,13 +28,28 @@ This test is run in a separate process because it changes memory behaviour.
 import unittest
 
 from ganeti import utils
+from ganeti import errors
 
 import testutils
 
 
-class TestResetTempfileModule(unittest.TestCase):
+class TestMlockallWithCtypes(unittest.TestCase):
+  """Whether Mlockall() works if ctypes is present.
+
+  """
+
+  def test(self):
+    if utils.ctypes:
+      utils.Mlockall()
+
+
+class TestMlockallWithNoCtypes(unittest.TestCase):
+  """Whether Mlockall() raises an error if ctypes is not present.
+
+  """
+
   def test(self):
-    utils.Mlockall()
+    self.assertRaises(errors.NoCtypesError, utils.Mlockall, _ctypes=None)
 
 
 if __name__ == "__main__":