[rhel6-branch 17/30] Remove resizing tests for TmpFS and also its getExistingSize method.
mulkieran
installerbot-noreply at redhat.com
Thu May 28 21:04:22 UTC 2015
From: Anne Mulhern <amulhern at redhat.com>
Resizing is not actually enabled for TmpFS, the tests use a hack to
enable resizing so that they can be run.
Also, getExistingSize() does not work properly on RHEL6, as df on RHEL6
does not accept --output option.
Signed-off-by: Anne Mulhern <amulhern at redhat.com>
---
blivet/formats/fs.py | 25 -------------------------
tests/formats_test/fs_test.py | 38 --------------------------------------
2 files changed, 63 deletions(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 1306833..6187992 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -1562,31 +1562,6 @@ def destroy(self, *args, **kwargs):
"""
pass
- def _getExistingSize(self, info=None):
- """ Get current size of tmpfs filesystem using df.
-
- :param NoneType info: a dummy parameter
- :rtype: Size
- :returns: the current size of the filesystem, 0 if not found.
- """
- if not self.status:
- return Size(0)
-
- df = ["df", self._mountpoint, "--output=size"]
- try:
- (ret, out) = util.run_program_and_capture_output(df)
- except OSError:
- return Size(0)
-
- if ret:
- return Size(0)
-
- lines = out.split()
- if len(lines) != 2 or lines[0] != "1K-blocks":
- return Size(0)
-
- return Size("%s KiB" % lines[1])
-
@property
def mountable(self):
return True
diff --git a/tests/formats_test/fs_test.py b/tests/formats_test/fs_test.py
index 5c32a81..691ac8a 100755
--- a/tests/formats_test/fs_test.py
+++ b/tests/formats_test/fs_test.py
@@ -1,10 +1,7 @@
#!/usr/bin/python
-import os
-import tempfile
import unittest2 as unittest
import blivet.formats.fs as fs
-from blivet.size import Size, ROUND_DOWN
from tests import loopbackedtestcase
@@ -119,40 +116,5 @@ def testSimple(self):
self.assertEqual(an_fs.device, "tmpfs")
self.assertTrue(an_fs.testMount())
-class ResizeTmpFSTestCase(loopbackedtestcase.LoopBackedTestCase):
-
- def __init__(self, methodName='runTest'):
- super(ResizeTmpFSTestCase, self).__init__(methodName=methodName)
- self.an_fs = fs.TmpFS()
- self.an_fs.__class__._resizable = True
- self.mountpoint = None
-
- def setUp(self):
- self.mountpoint = tempfile.mkdtemp()
- self.an_fs.mountpoint = self.mountpoint
- self.an_fs.mount()
-
- def testResize(self):
- self.an_fs.updateSizeInfo()
- newsize = self.an_fs.currentSize * 2
- self.an_fs.targetSize = newsize
- self.assertIsNone(self.an_fs.doResize())
- self.assertEqual(self.an_fs.size, newsize.roundToNearest(self.an_fs._resizefsUnit, rounding=ROUND_DOWN))
-
- def testShrink(self):
- # Can not shrink tmpfs, because its minimum size is its current size
- self.an_fs.updateSizeInfo()
- newsize = Size("2 MiB")
- self.assertTrue(newsize < self.an_fs.currentSize)
- with self.assertRaises(ValueError):
- self.an_fs.targetSize = newsize
-
- def teardown(self):
- try:
- self.an_fs.unmount()
- except Exception: # pylint: disable=broad-except
- pass
- os.rmdir(self.mountpoint)
-
if __name__ == "__main__":
unittest.main()
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/96c2597266454691d9cfddd4963fe064a7dc98db
More information about the anaconda-patches
mailing list