Change in vdsm[master]: v2v: Add tests for get_ova_info

nsoffer at redhat.com nsoffer at redhat.com
Sun Dec 13 16:03:03 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: v2v: Add tests for get_ova_info
......................................................................


Patch Set 6:

(3 comments)

Nice!

https://gerrit.ovirt.org/#/c/50158/6/tests/v2vTests.py
File tests/v2vTests.py:

Line 374:             vm = v2v.get_ova_info(self.ovapath)
Line 375:             self.check(vm['vmList'])
Line 376: 
Line 377:     @contextmanager
Line 378:     def init(self):
Nice!

Call this temporary_ovf_dir() and yield paths:

Caller can do:

    with self.temporary_ovf_dir() as (ovapath, ovfpath):
        ...
Line 379:         with namedTemporaryDir() as base:
Line 380:             self.base = base
Line 381:             self.ovfpath = os.path.join(base, 'testvm.ovf')
Line 382:             self.ovapath = os.path.join(base, 'testvm.ova')


Line 378:     def init(self):
Line 379:         with namedTemporaryDir() as base:
Line 380:             self.base = base
Line 381:             self.ovfpath = os.path.join(base, 'testvm.ovf')
Line 382:             self.ovapath = os.path.join(base, 'testvm.ova')
context manager that change the instance state is little ugly.
Line 383:             ovf = read_ovf('test')
Line 384: 
Line 385:             with open(self.ovfpath, 'w') as ovffile:
Line 386:                 ovffile.write(ovf)


Line 383:             ovf = read_ovf('test')
Line 384: 
Line 385:             with open(self.ovfpath, 'w') as ovffile:
Line 386:                 ovffile.write(ovf)
Line 387:             yield
yield ovfpath, ovapath
Line 388: 
Line 389:     def check(self, vm):
Line 390:         self.assertEquals(vm['vmName'], 'First')
Line 391:         self.assertEquals(vm['memSize'], 2048)


-- 
To view, visit https://gerrit.ovirt.org/50158
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id73516164e81e609c70caeac20fb819eaf04a56b
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list