Esempio n. 1
0
    def test_vhd_util_call(self):
        mox = self.mox
        mox.StubOutWithMock(utils, 'execute')

        utils.execute('vhd-util', 'resize', '-n', 'vhdfile', '-s', '1024',
                      '-j', 'journal').AndReturn(('ignored', 'ignored'))

        mox.ReplayAll()

        image_utils.resize_vhd('vhdfile', 1024, 'journal')
        mox.VerifyAll()
Esempio n. 2
0
    def test_vhd_util_call(self):
        mox = self.mox
        mox.StubOutWithMock(utils, 'execute')

        utils.execute(
            'vhd-util', 'resize', '-n', 'vhdfile', '-s', '1024',
            '-j', 'journal').AndReturn(('ignored', 'ignored'))

        mox.ReplayAll()

        image_utils.resize_vhd('vhdfile', 1024, 'journal')
        mox.VerifyAll()
Esempio n. 3
0
    def test_vhd_util_call(self):
        mox = self.mox
        mox.StubOutWithMock(utils, "execute")

        utils.execute("vhd-util", "resize", "-n", "vhdfile", "-s", "1024", "-j", "journal").AndReturn(
            ("ignored", "ignored")
        )

        mox.ReplayAll()

        image_utils.resize_vhd("vhdfile", 1024, "journal")
        mox.VerifyAll()
Esempio n. 4
0
    def test_chain_of_two_vhds(self):
        self.mox.StubOutWithMock(image_utils, 'get_vhd_size')
        self.mox.StubOutWithMock(image_utils, 'temporary_dir')
        self.mox.StubOutWithMock(image_utils, 'resize_vhd')
        self.mox.StubOutWithMock(image_utils, 'coalesce_vhd')
        self.mox.StubOutWithMock(image_utils, 'temporary_file')

        image_utils.get_vhd_size('0.vhd').AndReturn(1024)
        image_utils.temporary_dir().AndReturn(fake_context('tdir'))
        image_utils.resize_vhd('1.vhd', 1024, 'tdir/vhd-util-resize-journal')
        image_utils.coalesce_vhd('0.vhd')
        self.mox.ReplayAll()

        result = image_utils.coalesce_chain(['0.vhd', '1.vhd'])
        self.mox.VerifyAll()
        self.assertEqual('1.vhd', result)
Esempio n. 5
0
    def test_chain_of_two_vhds(self):
        self.mox.StubOutWithMock(image_utils, 'get_vhd_size')
        self.mox.StubOutWithMock(image_utils, 'temporary_dir')
        self.mox.StubOutWithMock(image_utils, 'resize_vhd')
        self.mox.StubOutWithMock(image_utils, 'coalesce_vhd')
        self.mox.StubOutWithMock(image_utils, 'temporary_file')

        image_utils.get_vhd_size('0.vhd').AndReturn(1024)
        image_utils.temporary_dir().AndReturn(fake_context('tdir'))
        image_utils.resize_vhd('1.vhd', 1024, 'tdir/vhd-util-resize-journal')
        image_utils.coalesce_vhd('0.vhd')
        self.mox.ReplayAll()

        result = image_utils.coalesce_chain(['0.vhd', '1.vhd'])
        self.mox.VerifyAll()
        self.assertEquals('1.vhd', result)
Esempio n. 6
0
    def test_chain_of_two_vhds(self):
        self.mox.StubOutWithMock(image_utils, "get_vhd_size")
        self.mox.StubOutWithMock(image_utils, "temporary_dir")
        self.mox.StubOutWithMock(image_utils, "resize_vhd")
        self.mox.StubOutWithMock(image_utils, "coalesce_vhd")
        self.mox.StubOutWithMock(image_utils, "temporary_file")

        image_utils.get_vhd_size("0.vhd").AndReturn(1024)
        image_utils.temporary_dir().AndReturn(fake_context("tdir"))
        image_utils.resize_vhd("1.vhd", 1024, "tdir/vhd-util-resize-journal")
        image_utils.coalesce_vhd("0.vhd")
        self.mox.ReplayAll()

        result = image_utils.coalesce_chain(["0.vhd", "1.vhd"])
        self.mox.VerifyAll()
        self.assertEqual("1.vhd", result)