[blivet:rhel7/master 09/10] Add a test for labeling swap devices (#1038590)

David Lehman dlehman at redhat.com
Fri Jan 10 15:07:51 UTC 2014


On Thu, 2014-01-09 at 13:54 -0500, mulhern wrote:
> Related: rhbz#1038590
> 
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
>  tests/formats_test/misc_test.py | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

ACK, in spite of the fact that you refer to swap space as a filesystem
in there.

> 
> diff --git a/tests/formats_test/misc_test.py b/tests/formats_test/misc_test.py
> index be3b98a..6593f67 100755
> --- a/tests/formats_test/misc_test.py
> +++ b/tests/formats_test/misc_test.py
> @@ -5,7 +5,7 @@ import unittest
>  from devicelibs_test import baseclass
>  from blivet.formats import device_formats
>  import blivet.formats.fs as fs
> -import blivet.formats.swas as swap
> +import blivet.formats.swap as swap
>  
>  class InitializationTestCase(unittest.TestCase):
>      """Test FS object initialization."""
> @@ -165,6 +165,14 @@ class LabelingAsRootTestCase(baseclass.DevicelibsTestCase):
>          an_fs.label = None
>          self.assertIsNone(an_fs.writeLabel())
>  
> +    @unittest.skipUnless(os.geteuid() == 0, "requires root privileges")
> +    def testLabelingSwapSpace(self):
> +        _LOOP_DEV0 = self._loopMap[self._LOOP_DEVICES[0]]
> +
> +        an_fs = swap.SwapSpace(device=_LOOP_DEV0)
> +        an_fs.label = "mkswap is really pretty permissive about labels"
> +        self.assertIsNone(an_fs.create())
> +
>  def suite():
>      suite1 = unittest.TestLoader().loadTestsFromTestCase(InitializationTestCase)
>      suite2 = unittest.TestLoader().loadTestsFromTestCase(MethodsTestCase)




More information about the anaconda-patches mailing list