def test_success_ignore_remaining(self, mock_converter): data = { 'image_deploy_flags': { 'rsync_flags': '-a -A -X' }, 'partitions': [{ 'extra': [], 'id': { 'type': 'name', 'value': 'vda' }, 'size': '10000 MB', 'type': 'disk', 'volumes': [{ 'file_system': 'ext4', 'mount': '/', 'size': 'remaining', 'type': 'partition' }, { 'file_system': 'ext4', 'mount': '/var', 'size': '4000', 'type': 'partition' }] }] } ironic.convert_string_sizes(data) mock_converter.assert_has_calls( [mock.call('10000 MB'), mock.call('4000')], any_order=True)
def test_success_two_disks(self, mock_converter): data = {'image_deploy_flags': {'rsync_flags': '-a -A -X'}, 'partitions': [{'extra': [], 'id': {'type': 'name', 'value': 'vda'}, 'size': '10000 MB', 'type': 'disk', 'volumes': [{'file_system': 'ext4', 'mount': '/', 'size': '5 GB', 'type': 'partition'}, {'file_system': 'ext4', 'mount': '/var', 'size': '4000', 'type': 'partition'}]}, {'extra': [], 'id': {'type': 'name', 'value': 'vdb'}, 'size': '2000 MB', 'type': 'disk', 'volumes': [{'file_system': 'ext4', 'mount': '/usr', 'size': '2 GB', 'type': 'partition'}]}]} ironic.convert_string_sizes(data) mock_converter.assert_has_calls( [mock.call('10000 MB'), mock.call('5 GB'), mock.call('4000'), mock.call('2000 MB'), mock.call('2 GB')], any_order=True)
def test_success_lvm_meta_size(self, mock_converter): data = {'image_deploy_flags': {'rsync_flags': '-a -A -X'}, 'partitions': [{'extra': [], 'id': {'type': 'name', 'value': 'vda'}, 'size': '10000 MB', 'type': 'disk', 'volumes': [{'file_system': 'ext4', 'mount': '/', 'size': '5 GB', 'type': 'partition'}, {"size": "4 GB", "type": "pv", "lvm_meta_size": "64", "vg": "os" }]}]} ironic.convert_string_sizes(data) mock_converter.assert_has_calls( [mock.call('10000 MB'), mock.call('5 GB'), mock.call('4 GB'), mock.call('64')], any_order=True)
def test_success_lvm_meta_size(self, mock_converter): data = { 'image_deploy_flags': { 'rsync_flags': '-a -A -X' }, 'partitions': [{ 'extra': [], 'id': { 'type': 'name', 'value': 'vda' }, 'size': '10000 MB', 'type': 'disk', 'volumes': [{ 'file_system': 'ext4', 'mount': '/', 'size': '5 GB', 'type': 'partition' }, { "size": "4 GB", "type": "pv", "lvm_meta_size": "64", "vg": "os" }] }] } ironic.convert_string_sizes(data) mock_converter.assert_has_calls([ mock.call('10000 MB'), mock.call('5 GB'), mock.call('4 GB'), mock.call('64') ], any_order=True)