@mock.patch('os.stat')
def test_convert_image(self, mock_stat):
- class stat_result:
- st_size = 1048576
-
mox = self._mox
mox.StubOutWithMock(utils, 'execute')
"cluster_size: 65536\n"
"disk_size: 196K (200704 bytes)\n")
- class stat_result:
- st_size = 1048576
-
self._test_fetch_to_raw(src_inf=SRC_INFO, dest_inf=DST_INFO)
image_utils.fetch_to_raw(context, self._image_service,
"cluster_size: 65536\n"
"disk_size: 196K (200704 bytes)\n")
- class stat_result:
- st_size = 1048576
-
self._test_fetch_to_raw(src_inf=SRC_INFO, dest_inf=DST_INFO,
bps_limit=1048576)
"cluster_size: 65536\n"
"disk_size: 196K (200704 bytes)")
- class stat_result:
- st_size = 1048576
-
self._test_fetch_to_raw(src_inf=IMG_INFO, dest_inf=IMG_INFO)
self.assertRaises(exception.ImageUnacceptable,
self._test_fetch_verify_image(TEST_RETURN)
- def test_upload_volume(self, bps_limit=0):
+ @mock.patch('os.stat')
+ def test_upload_volume(self, mock_stat, bps_limit=0):
image_meta = {'id': 1, 'disk_format': 'qcow2'}
TEST_RET = "image: qemu.qcow2\n"\
"file_format: qcow2 \n"\
"virtual_size: 50M (52428800 bytes)\n"\
"cluster_size: 65536\n"\
"disk_size: 196K (200704 bytes)"
+
if bps_limit:
CONF.set_override('volume_copy_bps_limit', bps_limit)
prefix = ('cgexec', '-g', 'blkio:test')
image_meta, '/dev/loop1')
m.VerifyAll()
- def test_upload_volume_with_bps_limit(self):
+ @mock.patch('os.stat')
+ def test_upload_volume_with_bps_limit(self, mock_stat):
+
self.test_upload_volume(bps_limit=1048576)
def test_upload_volume_with_raw_image(self):
image_meta, f.name)
mox.VerifyAll()
- def test_upload_volume_on_error(self):
+ @mock.patch('os.stat')
+ def test_upload_volume_on_error(self, mock_stat):
image_meta = {'id': 1, 'disk_format': 'qcow2'}
TEST_RET = "image: qemu.vhd\n"\
"file_format: vhd \n"\