Shahar Havivi has uploaded a new change for review.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
v2v: add test for getOvaInfo verb
Change-Id: I398943c356a87cf93a3e0557f4d78da0490814c5 Signed-off-by: Shahar Havivi shaharh@redhat.com --- M tests/v2vTests.py 1 file changed, 52 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/44471/1
diff --git a/tests/v2vTests.py b/tests/v2vTests.py index 520de61..20db6ee 100644 --- a/tests/v2vTests.py +++ b/tests/v2vTests.py @@ -90,6 +90,38 @@ def hypervisorConnect(uri, username, passwd): return LibvirtMock()
+def read_ovf(ovf_path): + return """<?xml version="1.0" encoding="UTF-8"?> +<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" + xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" + xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSett... + <References> + <File ovf:href="First-disk1.vmdk" ovf:id="file1" ovf:size="349405696"/> + </References> + <DiskSection> + <Disk ovf:capacity="32" ovf:fileRef="file1"/> + </DiskSection> + <VirtualSystem ovf:id="First"> + <Name>First</Name> + <VirtualHardwareSection> + <Item> + rasd:ResourceType4</rasd:ResourceType> + rasd:VirtualQuantity2048</rasd:VirtualQuantity> + </Item> + <Item> + rasd:ResourceType3</rasd:ResourceType> + rasd:VirtualQuantity1</rasd:VirtualQuantity> + </Item> + <Item> + rasd:ConnectionVM Network</rasd:Connection> + rasd:ElementNameEthernet 1</rasd:ElementName> + rasd:ResourceSubTypeE1000</rasd:ResourceSubType> + rasd:ResourceType10</rasd:ResourceType> + </Item> + </VirtualHardwareSection> + </VirtualSystem> +</Envelope>""" +
class v2vTests(TestCaseBase): @MonkeyPatch(libvirtconnection, 'open_connection', hypervisorConnect) @@ -139,3 +171,23 @@ (v2v.DiskProgress(0)), (v2v.DiskProgress(50)), (v2v.DiskProgress(100))]) + + @MonkeyPatch(v2v, '_read_ovf_from_ova', read_ovf) + def testGetOvaInfo(self): + ret = v2v.get_ova_info("dummy") + vm = ret['vmList'][0] + self.assertEquals(vm['vmName'], 'First') + self.assertEquals(vm['memSize'], 2048) + self.assertEquals(vm['smp'], 1) + + disk = vm['disks'][0] + self.assertEquals(disk['allocation'], '349405696') + self.assertEquals(disk['capacity'], '34359738368') + self.assertEquals(disk['type'], 'disk') + self.assertEquals(disk['alias'], 'First-disk1.vmdk') + + network = vm['networks'][0] + self.assertEquals(network['bridge'], 'VM Network') + self.assertEquals(network['model'], 'E1000') + self.assertEquals(network['type'], 'bridge') + self.assertEquals(network['dev'], 'Ethernet 1')
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Shahar Havivi has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 2: Verified+1
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Shahar Havivi has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 4: Verified+1
Francesco Romani has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 4: Code-Review+1
(2 comments)
partial ACK. please see comments inside.
https://gerrit.ovirt.org/#/c/44471/4//COMMIT_MSG Commit Message:
Line 3: AuthorDate: 2015-08-06 11:43:20 +0300 Line 4: Commit: Shahar Havivi shaharh@redhat.com Line 5: CommitDate: 2015-08-12 15:57:44 +0300 Line 6: Line 7: v2v: add test for getOvaInfo verb better:
tests for v2v.get_ova_info function.
In a future patch, I'd like to see more tests for the other functions added to v2v.py. Line 8: Line 9: Change-Id: I398943c356a87cf93a3e0557f4d78da0490814c5
https://gerrit.ovirt.org/#/c/44471/4/tests/v2vTests.py File tests/v2vTests.py:
Line 173: (v2v.DiskProgress(50)), Line 174: (v2v.DiskProgress(100))]) Line 175: Line 176: @MonkeyPatch(v2v, '_read_ovf_from_ova', read_ovf) Line 177: def testGetOvaInfo(self): it would be nicer split into finer grained tests, but I don't really mind. Line 178: ret = v2v.get_ova_info("dummy") Line 179: vm = ret['vmList'][0] Line 180: self.assertEquals(vm['vmName'], 'First') Line 181: self.assertEquals(vm['memSize'], 2048)
Francesco Romani has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 4: -Code-Review
initial review
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 6:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Shahar Havivi has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 6: Verified+1
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 7:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Francesco Romani has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 7: Code-Review+2
Francesco Romani has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 7:
rebased to trigger CI jobs.
Dan Kenigsberg has submitted this change and it was merged.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
v2v: add test for getOvaInfo verb
Change-Id: I398943c356a87cf93a3e0557f4d78da0490814c5 Signed-off-by: Shahar Havivi shaharh@redhat.com Reviewed-on: https://gerrit.ovirt.org/44471 Tested-by: Shahar Havivi shavivi@redhat.com Reviewed-by: Francesco Romani fromani@redhat.com Continuous-Integration: Jenkins CI --- M tests/v2vTests.py 1 file changed, 53 insertions(+), 0 deletions(-)
Approvals: Shahar Havivi: Verified Jenkins CI: Passed CI tests Francesco Romani: Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: v2v: add test for getOvaInfo verb ......................................................................
Patch Set 8:
* Update tracker::IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org