kiwi-el8/test/unit/system_size_test.py
Marcus Schäfer c3a5178a33 Fix space calculation for lvm volumes
It is required to take the other configured volumes into
account in order to solve the problem of nested volumes.
The size of e.g the root volume must be reduced by the size
other volumes inside of the root volume needs. This is
especially required if the root volume is not the fullsize
volume
2017-08-09 22:36:34 +02:00

40 lines
1.1 KiB
Python

from mock import patch
import mock
from kiwi.system.size import SystemSize
class TestSystemSize(object):
def setup(self):
self.size = SystemSize('directory')
def test_customize_ext(self):
self.size.accumulate_files = mock.Mock(
return_value=10000
)
assert self.size.customize(42, 'ext3') == 67
def test_customize_btrfs(self):
assert self.size.customize(42, 'btrfs') == 63
def test_customize_xfs(self):
assert self.size.customize(42, 'xfs') == 63
@patch('kiwi.system.size.Command.run')
def test_accumulate_mbyte_file_sizes(self, mock_command):
self.size.accumulate_mbyte_file_sizes(['/foo'])
mock_command.assert_called_once_with(
[
'du', '-s', '--apparent-size', '--block-size', '1',
'--exclude', '/foo', 'directory'
]
)
@patch('kiwi.system.size.Command.run')
def test_accumulate_files(self, mock_command):
self.size.accumulate_files()
mock_command.assert_called_once_with(
['bash', '-c', 'find directory | wc -l']
)