The former implementation builds a new device map which is a subset of the low level device map. However due to the additional swap partition the maps provided by the VolumeManager classes are now incomplete. Instead this commit changes the VolumeManager interface to receive the current low level device_map and merged device changes on top of it when needed.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
from mock import (
|
|
patch, Mock
|
|
)
|
|
from pytest import raises
|
|
|
|
from kiwi.volume_manager import VolumeManager
|
|
|
|
from kiwi.exceptions import KiwiVolumeManagerSetupError
|
|
|
|
|
|
class TestVolumeManager:
|
|
def test_volume_manager_not_implemented(self):
|
|
with raises(KiwiVolumeManagerSetupError):
|
|
VolumeManager('foo', Mock(), 'root_dir', Mock())
|
|
|
|
@patch('kiwi.volume_manager.VolumeManagerLVM')
|
|
@patch('os.path.exists')
|
|
def test_volume_manager_lvm(self, mock_path, mock_lvm):
|
|
mock_path.return_value = True
|
|
device_map = Mock()
|
|
volumes = Mock()
|
|
VolumeManager('lvm', device_map, 'root_dir', volumes)
|
|
mock_lvm.assert_called_once_with(
|
|
device_map, 'root_dir', volumes, None
|
|
)
|
|
|
|
@patch('kiwi.volume_manager.VolumeManagerBtrfs')
|
|
@patch('os.path.exists')
|
|
def test_volume_manager_btrfs(self, mock_path, mock_btrfs):
|
|
mock_path.return_value = True
|
|
device_map = Mock()
|
|
volumes = Mock()
|
|
VolumeManager('btrfs', device_map, 'root_dir', volumes)
|
|
mock_btrfs.assert_called_once_with(
|
|
device_map, 'root_dir', volumes, None
|
|
)
|