~ltrager/maas/remove_di_from_kernel_opts

« back to all changes in this revision

Viewing changes to src/maasserver/models/tests/test_partitiontable.py

  • Committer: Lee Trager
  • Date: 2016-10-22 06:06:12 UTC
  • mfrom: (5457.1.44 maas)
  • Revision ID: lee.trager@canonical.com-20161022060612-ukar20f6ffs45nas
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    PARTITION_ALIGNMENT_SIZE,
21
21
)
22
22
from maasserver.models.partitiontable import (
 
23
    BIOS_GRUB_PARTITION_SIZE,
23
24
    PARTITION_TABLE_EXTRA_SPACE,
24
25
    PREP_PARTITION_SIZE,
25
26
)
59
60
                False),
60
61
            partition_table.get_size())
61
62
 
 
63
    def test_get_size_returns_block_device_size_minus_amd64_gpt(self):
 
64
        node = factory.make_Node(architecture="amd64/generic")
 
65
        block_device = factory.make_PhysicalBlockDevice(
 
66
            node=node, size=2 * (1024 ** 4))
 
67
        partition_table = factory.make_PartitionTable(
 
68
            block_device=block_device)
 
69
        self.assertEqual(
 
70
            round_size_to_nearest_block(
 
71
                partition_table.block_device.size -
 
72
                PARTITION_TABLE_EXTRA_SPACE - BIOS_GRUB_PARTITION_SIZE,
 
73
                PARTITION_ALIGNMENT_SIZE,
 
74
                False),
 
75
            partition_table.get_size())
 
76
 
62
77
    def test_get_block_size_returns_block_device_block_size(self):
63
78
        partition_table = factory.make_PartitionTable()
64
79
        self.assertEqual(
148
163
            PARTITION_TABLE_EXTRA_SPACE + PREP_PARTITION_SIZE,
149
164
            partition_table.get_overhead_size())
150
165
 
 
166
    def test_get_overhead_size_for_amd64_gpt(self):
 
167
        node = factory.make_Node(architecture="amd64/generic")
 
168
        block_device = factory.make_PhysicalBlockDevice(
 
169
            node=node, size=2 * (1024 ** 4))
 
170
        partition_table = factory.make_PartitionTable(
 
171
            block_device=block_device)
 
172
        self.assertEquals(
 
173
            PARTITION_TABLE_EXTRA_SPACE + BIOS_GRUB_PARTITION_SIZE,
 
174
            partition_table.get_overhead_size())
 
175
 
151
176
    def test_get_available_size(self):
152
177
        block_size = 4096
153
178
        device = factory.make_BlockDevice(