def test_file_raw(self, base, top, expected): with make_env('file', base, top) as env: merge.prepare(env.subchain) base_vol = env.subchain.base_vol assert sc.LEGAL_VOL == base_vol.getLegality() new_base_size = base_vol.getSizeBlk() * sc.BLOCK_SIZE assert expected.virtual * GB == new_base_size
def test_file_raw(self, base, top, expected): with make_env('file', base, top) as env: merge.prepare(env.subchain) base_vol = env.subchain.base_vol self.assertEqual(sc.LEGAL_VOL, base_vol.getLegality()) new_base_size = base_vol.getSize() * sc.BLOCK_SIZE self.assertEqual(expected.virtual * GB, new_base_size)
def test_file_raw(self, base, top, expected): with make_env('file', base, top) as env: merge.prepare(env.subchain) base_vol = env.subchain.base_vol assert sc.LEGAL_VOL == base_vol.getLegality() new_base_size = base_vol.getSize() * sc.BLOCK_SIZE assert expected.virtual * GB == new_base_size
def test_file_cow(self, base, top, expected): with make_env('file', base, top) as env: merge.prepare(env.subchain) base_vol = env.subchain.base_vol assert sc.LEGAL_VOL == base_vol.getLegality() new_base_size = base_vol.getCapacity() assert expected.virtual * GiB == new_base_size
def test_block_cow(self, monkeypatch, base, top, expected): with make_env('block', base, top) as env: base_vol = env.subchain.base_vol top_vol = env.subchain.top_vol def fake_measure(image, format=None, output_format=None, backing=True, is_block=False, base=None, unsafe=False): # Make sure we are called with the right arguments. assert image == top_vol.getVolumePath() assert format == qemuimg.FORMAT.QCOW2 assert output_format == qemuimg.FORMAT.QCOW2 assert backing assert is_block assert base == base_vol.getVolumePath() assert not unsafe # Return fake response. return {"required": 2048 * MiB, "bitmaps": 1 * MiB} monkeypatch.setattr(qemuimg, "measure", fake_measure) merge.prepare(env.subchain) assert self.expected_locks(env.subchain) == guarded.context.locks assert sc.LEGAL_VOL == base_vol.getLegality() assert expected.virtual * MiB == base_vol.getCapacity() new_size = env.sd_manifest.getVSize(base_vol.imgUUID, base_vol.volUUID) assert expected.physical * MiB == new_size
def test_block_raw(self, base, top, expected): with make_env('block', base, top) as env: merge.prepare(env.subchain) assert self.expected_locks(env.subchain) == guarded.context.locks base_vol = env.subchain.base_vol assert sc.LEGAL_VOL == base_vol.getLegality() new_base_size = base_vol.getSizeBlk() * sc.BLOCK_SIZE new_base_alloc = env.sd_manifest.getVSize(base_vol.imgUUID, base_vol.volUUID) assert expected.virtual * GB == new_base_size assert expected.physical * GB == new_base_alloc
def test_block_raw(self, base, top, expected): with make_env('block', base, top) as env: merge.prepare(env.subchain) assert self.expected_locks(env.subchain) == guarded.context.locks base_vol = env.subchain.base_vol assert sc.LEGAL_VOL == base_vol.getLegality() new_base_size = base_vol.getSize() * sc.BLOCK_SIZE new_base_alloc = env.sd_manifest.getVSize(base_vol.imgUUID, base_vol.volUUID) assert expected.virtual * GB == new_base_size assert expected.physical * GB == new_base_alloc
def test_block_raw(self, base, top, expected): with make_env('block', base, top) as env: merge.prepare(env.subchain) self.assertEqual(sorted(self.expected_locks(env.subchain)), sorted(guarded.context.locks)) base_vol = env.subchain.base_vol self.assertEqual(sc.LEGAL_VOL, base_vol.getLegality()) new_base_size = base_vol.getSize() * sc.BLOCK_SIZE new_base_alloc = env.sd_manifest.getVSize(base_vol.imgUUID, base_vol.volUUID) self.assertEqual(expected.virtual * GB, new_base_size) self.assertEqual(expected.physical * GB, new_base_alloc)