Beispiel #1
0
 def setup(self, mock_exists):
     mock_exists.return_value = True
     provider = mock.Mock()
     provider.get_device = mock.Mock(return_value='/dev/foo')
     self.btrfs = FileSystemBtrfs(provider, 'root_dir')
     self.btrfs.setup_mountpoint = mock.Mock(
         return_value='some-mount-point')
Beispiel #2
0
class TestFileSystemBtrfs:
    @patch('os.path.exists')
    def setup(self, mock_exists):
        mock_exists.return_value = True
        provider = mock.Mock()
        provider.get_device = mock.Mock(return_value='/dev/foo')
        self.btrfs = FileSystemBtrfs(provider, 'root_dir')
        self.btrfs.setup_mountpoint = mock.Mock(
            return_value='some-mount-point')

    @patch('os.path.exists')
    def setup_method(self, cls, mock_exists):
        self.setup()

    @patch('kiwi.filesystem.btrfs.Command.run')
    def test_create_on_device(self, mock_command):
        self.btrfs.create_on_device('label', 100, uuid='uuid')
        call = mock_command.call_args_list[0]
        assert mock_command.call_args_list[0] == call([
            'mkfs.btrfs', '-L', 'label', '-U', 'uuid', '--byte-count',
            '102400', '/dev/foo'
        ])

    @patch('kiwi.filesystem.btrfs.Command.run')
    def test_set_uuid(self, mock_command):
        self.btrfs.set_uuid()
        mock_command.assert_called_once_with(['btrfstune', '-u', '/dev/foo'])
Beispiel #3
0
class TestFileSystemBtrfs(object):
    @patch('os.path.exists')
    def setup(self, mock_exists):
        mock_exists.return_value = True
        provider = mock.Mock()
        provider.get_device = mock.Mock(return_value='/dev/foo')
        self.btrfs = FileSystemBtrfs(provider, 'root_dir')
        self.btrfs.setup_mountpoint = mock.Mock(
            return_value='some-mount-point')

    @patch('kiwi.filesystem.btrfs.Command.run')
    def test_create_on_device(self, mock_command):
        self.btrfs.create_on_device('label')
        call = mock_command.call_args_list[0]
        assert mock_command.call_args_list[0] == \
            call(['mkfs.btrfs', '-L', 'label', '/dev/foo'])
Beispiel #4
0
 def setup(self, mock_exists):
     mock_exists.return_value = True
     provider = mock.Mock()
     provider.get_device = mock.Mock(
         return_value='/dev/foo'
     )
     self.btrfs = FileSystemBtrfs(provider, 'root_dir')
     self.btrfs.setup_mountpoint = mock.Mock(
         return_value='some-mount-point'
     )
Beispiel #5
0
class TestFileSystemBtrfs(object):
    @patch('os.path.exists')
    def setup(self, mock_exists):
        mock_exists.return_value = True
        provider = mock.Mock()
        provider.get_device = mock.Mock(
            return_value='/dev/foo'
        )
        self.btrfs = FileSystemBtrfs(provider, 'root_dir')
        self.btrfs.setup_mountpoint = mock.Mock(
            return_value='some-mount-point'
        )

    @patch('kiwi.filesystem.btrfs.Command.run')
    def test_create_on_device(self, mock_command):
        self.btrfs.create_on_device('label')
        call = mock_command.call_args_list[0]
        assert mock_command.call_args_list[0] == \
            call(['mkfs.btrfs', '-L', 'label', '/dev/foo'])
Beispiel #6
0
 def __new__(self, name, device_provider, root_dir=None, custom_args=None):
     if name == 'ext2':
         return FileSystemExt2(device_provider, root_dir, custom_args)
     elif name == 'ext3':
         return FileSystemExt3(device_provider, root_dir, custom_args)
     elif name == 'ext4':
         return FileSystemExt4(device_provider, root_dir, custom_args)
     elif name == 'btrfs':
         return FileSystemBtrfs(device_provider, root_dir, custom_args)
     elif name == 'xfs':
         return FileSystemXfs(device_provider, root_dir, custom_args)
     elif name == 'fat16':
         return FileSystemFat16(device_provider, root_dir, custom_args)
     elif name == 'fat32':
         return FileSystemFat32(device_provider, root_dir, custom_args)
     elif name == 'squashfs':
         return FileSystemSquashFs(device_provider, root_dir, custom_args)
     elif name == 'clicfs':
         return FileSystemClicFs(device_provider, root_dir, custom_args)
     elif name == 'swap':
         return FileSystemSwap(device_provider, root_dir, custom_args)
     else:
         raise KiwiFileSystemSetupError(
             'Support for %s filesystem not implemented' % name)