diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py index 13068331e..618799231 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 5c32a8122..691ac8a21 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()