Ejemplo n.º 1
0
    def test_get_partitioning(self, platform, suggest_swap_size):
        storage = create_storage()

        # Set the platform specs.
        platform.partitions = [PartSpec(mountpoint="/boot", size=Size("1GiB"))]

        # Set the file system type for /boot.
        storage._bootloader = Mock(stage2_format_types=["xfs"])

        # Set the swap size.
        suggest_swap_size.return_value = Size("1024MiB")

        # Collect the requests.
        requests = AutomaticPartitioningTask._get_partitioning(
            storage=storage, excluded_mount_points=["/home", "/boot", "swap"])

        assert ["/"] == [spec.mountpoint for spec in requests]

        requests = AutomaticPartitioningTask._get_partitioning(
            storage=storage, excluded_mount_points=[])

        assert ["/boot", "/", "/home"] == \
            [spec.mountpoint for spec in requests]
        assert ["xfs", "ext4", "ext4"] == \
            [spec.fstype for spec in requests]
        assert [Size("1GiB"), Size("1GiB"), Size("500MiB")] == \
            [spec.size for spec in requests]
Ejemplo n.º 2
0
    def test_get_partitioning_btrfs_only(self, platform, mocked_conf):
        storage = create_storage()
        platform.partitions = []

        # Set the default partitioning.
        mocked_conf.storage.default_partitioning = [{
            'name': '/',
            'size': Size("50 GiB"),
        }, {
            'name': '/var',
            'btrfs': True,
        }]

        # Collect the requests for the Btrfs scheme.
        requests = AutomaticPartitioningTask._get_partitioning(
            storage=storage,
            scheme=AUTOPART_TYPE_BTRFS,
        )

        assert ["/", "/var"] == [spec.mountpoint for spec in requests]

        # Collect the requests for the LVM scheme.
        requests = AutomaticPartitioningTask._get_partitioning(
            storage=storage,
            scheme=AUTOPART_TYPE_LVM,
        )

        assert ["/"] == [spec.mountpoint for spec in requests]