If devicepersistency="by-label" is set in the KIWI description it will correctly operate on the fstab values but still uses the UUID based setting for root= in the grub config. This commit allows to set root=LABEL=... in the grub config in case the devicepersistency requested it. In order for this to work this commit also had to increase the scope of the grub helper method _fix_grub_root_device_reference which is now called in any case. This Fixes #1757
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from mock import patch
|
|
|
|
from kiwi.utils.block import BlockID
|
|
|
|
|
|
class TestBlockID:
|
|
def setup(self):
|
|
self.blkid = BlockID('device')
|
|
|
|
@patch('kiwi.utils.block.Command.run')
|
|
def test_setup_with_uuid_format(self, mock_command):
|
|
BlockID('UUID=uuid')
|
|
mock_command.assert_called_once_with(
|
|
['blkid', '--uuid', 'uuid']
|
|
)
|
|
|
|
@patch('kiwi.utils.block.Command.run')
|
|
def test_get_blkid(self, mock_command):
|
|
self.blkid.get_blkid('LABEL')
|
|
mock_command.assert_called_once_with(
|
|
['blkid', 'device', '-s', 'LABEL', '-o', 'value']
|
|
)
|
|
|
|
@patch('kiwi.utils.block.BlockID.get_blkid')
|
|
def test_get_filesystem(self, mock_get_blkid):
|
|
self.blkid.get_filesystem()
|
|
mock_get_blkid.assert_called_once_with('TYPE')
|
|
|
|
@patch('kiwi.utils.block.BlockID.get_blkid')
|
|
def test_get_label(self, mock_get_blkid):
|
|
self.blkid.get_label()
|
|
mock_get_blkid.assert_called_once_with('LABEL')
|
|
|
|
@patch('kiwi.utils.block.BlockID.get_blkid')
|
|
def test_get_uuid(self, mock_get_blkid):
|
|
self.blkid.get_uuid()
|
|
mock_get_blkid.assert_called_once_with('UUID')
|