<p dir="ltr">For short lists using sorted output will make the code easier to debug and test.</p>
<div class="gmail_extra"><br><div class="gmail_quote">בתאריך 13 באוק׳ 2016 11:03 לפנה״צ, "Francesco Romani" <<a href="mailto:fromani@redhat.com">fromani@redhat.com</a>> כתב:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">----- Original Message -----<br>
> From: "Nir Soffer" <<a href="mailto:nsoffer@redhat.com">nsoffer@redhat.com</a>><br>
> To: "devel" <<a href="mailto:devel@ovirt.org">devel@ovirt.org</a>>, "Adam Litke" <<a href="mailto:alitke@redhat.com">alitke@redhat.com</a>>, "Dan Kenigsberg" <<a href="mailto:danken@redhat.com">danken@redhat.com</a>>, "Francesco<br>
> Romani" <<a href="mailto:fromani@redhat.com">fromani@redhat.com</a>>, "Piotr Kliczewski" <<a href="mailto:pkliczew@redhat.com">pkliczew@redhat.com</a>>, "Martin Sivak" <<a href="mailto:msivak@redhat.com">msivak@redhat.com</a>><br>
> Sent: Wednesday, October 12, 2016 8:14:11 PM<br>
> Subject: [VDSM] Tests failing because of ordering dependencies<br>
><br>
> Hi all,<br>
><br>
> Trying to run vdsm tests via tox (so correct nose is used automatically),<br>
> some of the tests fail.<br>
><br>
> The failure are all about ordering expectations, which look wrong.<br>
><br>
> Please check and fix your tests.<br>
><br>
> Thanks,<br>
> Nir<br>
<br>
> 18:04:10 -------------------- >> begin captured logging <<<br>
> --------------------<br>
> 18:04:10 2016-10-12 18:01:56,902 INFO (MainThread) [MOM] Preparing<br>
> MOM interface (momIF:49)<br>
> 18:04:10 2016-10-12 18:01:56,903 INFO (MainThread) [MOM] Using<br>
> named unix socket /tmp/tmpqOQZvm/test_mom_vdsm.<wbr>sock (momIF:58)<br>
> 18:04:10 --------------------- >> end captured logging <<<br>
> ---------------------<br>
> 18:04:10<br>
> 18:04:10<br>
> ==============================<wbr>==============================<wbr>==========<br>
> 18:04:10 FAIL: test_disk_virtio_cache (vmStorageTests.DriveXMLTests)<br>
> 18:04:10<br>
> ------------------------------<wbr>------------------------------<wbr>----------<br>
> 18:04:10 Traceback (most recent call last):<br>
> 18:04:10 File<br>
> "/home/jenkins/workspace/vdsm_<wbr>master_check-patch-el7-x86_64/<wbr>vdsm/tests/vmStorageTests.py",<br>
> line 84, in test_disk_virtio_cache<br>
> 18:04:10 self.check(vm_conf, conf, xml, is_block_device=False)<br>
> 18:04:10 File<br>
> "/home/jenkins/workspace/vdsm_<wbr>master_check-patch-el7-x86_64/<wbr>vdsm/tests/vmStorageTests.py",<br>
> line 222, in check<br>
> 18:04:10 self.assertXMLEqual(drive.<wbr>getXML().toxml(), xml)<br>
> 18:04:10 File<br>
> "/home/jenkins/workspace/vdsm_<wbr>master_check-patch-el7-x86_64/<wbr>vdsm/tests/testlib.py",<br>
> line 253, in assertXMLEqual<br>
> 18:04:10 (actualXML, expectedXML))<br>
> 18:04:10 AssertionError: XMLs are different:<br>
> 18:04:10 Actual:<br>
> 18:04:10 <disk device="disk" snapshot="no" type="file"><br>
> 18:04:10 <source file="/path/to/volume" /><br>
> 18:04:10 <target bus="virtio" dev="vda" /><br>
> 18:04:10 <shareable /><br>
> 18:04:10 <serial>54-a672-23e5b495a9ea</<wbr>serial><br>
> 18:04:10 <driver cache="writethrough" error_policy="enospace"<br>
> io="threads" name="qemu" type="qcow2" /><br>
> 18:04:10 <iotune><br>
> 18:04:10 <total_iops_sec>800</total_<wbr>iops_sec><br>
> 18:04:10 <read_bytes_sec>6120000</read_<wbr>bytes_sec><br>
> 18:04:10 </iotune><br>
> 18:04:10 </disk><br>
> 18:04:10<br>
> 18:04:10 Expected:<br>
> 18:04:10 <disk device="disk" snapshot="no" type="file"><br>
> 18:04:10 <source file="/path/to/volume" /><br>
> 18:04:10 <target bus="virtio" dev="vda" /><br>
> 18:04:10 <shareable /><br>
> 18:04:10 <serial>54-a672-23e5b495a9ea</<wbr>serial><br>
> 18:04:10 <driver cache="writethrough" error_policy="enospace"<br>
> io="threads" name="qemu" type="qcow2" /><br>
> 18:04:10 <iotune><br>
> 18:04:10 <read_bytes_sec>6120000</read_<wbr>bytes_sec><br>
> 18:04:10 <total_iops_sec>800</total_<wbr>iops_sec><br>
><br>
> Order of these elements differ, need to check why.<br>
<br>
Most likely because we build the xml like<br>
<br>
(vdsm/virt/vmdevices/storage.<wbr>py)<br>
<br>
def _getIotuneXML(self):<br>
iotune = vmxml.Element('iotune')<br>
for key, value in self.specParams['ioTune'].<wbr>iteritems():<br>
iotune.appendChildWithArgs(<wbr>key, text=str(value))<br>
return iotune<br>
<br>
and iteritems() ordering is not defined<br>
> ------------------------------<wbr>------------------------------<wbr>----------<br>
> 18:04:10 Traceback (most recent call last):<br>
> 18:04:10 File<br>
> "/home/jenkins/workspace/vdsm_<wbr>master_check-patch-el7-x86_64/<wbr>vdsm/tests/vmTests.py",<br>
> line 434, in testCpuXML<br>
> 18:04:10 self.assertXMLEqual(find_xml_<wbr>element(xml, "./cputune"),<br>
> cputuneXML)<br>
> 18:04:10 File<br>
> "/home/jenkins/workspace/vdsm_<wbr>master_check-patch-el7-x86_64/<wbr>vdsm/tests/testlib.py",<br>
> line 253, in assertXMLEqual<br>
> 18:04:10 (actualXML, expectedXML))<br>
> 18:04:10 AssertionError: XMLs are different:<br>
> 18:04:10 Actual:<br>
> 18:04:10 <cputune><br>
> 18:04:10 <vcpupin cpuset="0-1" vcpu="0" /><br>
> 18:04:10 <vcpupin cpuset="2-3" vcpu="1" /><br>
> 18:04:10 </cputune><br>
> 18:04:10<br>
> 18:04:10 Expected:<br>
> 18:04:10 <cputune><br>
> 18:04:10 <vcpupin cpuset="2-3" vcpu="1" /><br>
> 18:04:10 <vcpupin cpuset="0-1" vcpu="0" /><br>
><br>
> Same<br>
<br>
(vdsm/virt/vmxml.py)<br>
<br>
def appendCpus(self):<br>
# lot of code<br>
<br>
# CPU-pinning support<br>
# see <a href="http://www.ovirt.org/wiki/Features/Design/cpu-pinning" rel="noreferrer" target="_blank">http://www.ovirt.org/wiki/<wbr>Features/Design/cpu-pinning</a><br>
if 'cpuPinning' in self.conf:<br>
cputune = Element('cputune')<br>
cpuPinning = self.conf.get('cpuPinning')<br>
for cpuPin in cpuPinning.keys():<br>
cputune.appendChildWithArgs('<wbr>vcpupin', vcpu=cpuPin,<br>
cpuset=cpuPinning[cpuPin])<br>
self.dom.appendChild(cputune)<br>
<br>
<br>
<br>
> 18:04:10 </cputune><br>
> 18:04:10<br>
> 18:04:10<br>
> 18:04:10<br>
> 18:04:10<br>
> ==============================<wbr>==============================<wbr>==========<br>
> 18:04:10 FAIL: testSetIoTune (vmTests.TestVm)<br>
> 18:04:10<br>
> ------------------------------<wbr>------------------------------<wbr>----------<br>
> 18:04:10 Traceback (most recent call last):<br>
> 18:04:10 File<br>
> "/home/jenkins/workspace/vdsm_<wbr>master_check-patch-el7-x86_64/<wbr>vdsm/tests/vmTests.py",<br>
> line 936, in testSetIoTune<br>
> 18:04:10 self._xml_sanitizer(expected_<wbr>xml))<br>
> 18:04:10 AssertionError: '<disk device="hdd" snapshot="no"<br>
> type="block"><source dev="/dev/dummy"/><target bus="ide"<br>
> dev="hda"/><iotune><write_<wbr>bytes_sec>1</write_bytes_sec><<wbr>total_bytes_sec>0</total_<wbr>bytes_sec><read_bytes_sec>2</<wbr>read_bytes_sec></iotune></<wbr>disk>'<br>
> != '<disk device="hdd" snapshot="no" type="block"><source<br>
> dev="/dev/dummy"/><target bus="ide"<br>
> dev="hda"/><iotune><read_<wbr>bytes_sec>2</read_bytes_sec><<wbr>write_bytes_sec>1</write_<wbr>bytes_sec><total_bytes_sec>0</<wbr>total_bytes_sec></iotune></<wbr>disk>'<br>
> 18:04:10 -------------------- >> begin captured logging <<<br>
> --------------------<br>
> 18:04:10 2016-10-12 18:03:34,110 INFO (MainThread) [virt.vm]<br>
> vmId=`TESTING`::New device XML for hda: <disk device="hdd"<br>
> snapshot="no" type="block"><br>
> 18:04:10 <source dev="/dev/dummy"/><br>
> 18:04:10 <target bus="ide" dev="hda"/><br>
> 18:04:10 <iotune><br>
> 18:04:10 <write_bytes_sec>1</write_<wbr>bytes_sec><br>
> 18:04:10 <total_bytes_sec>0</total_<wbr>bytes_sec><br>
> 18:04:10 <read_bytes_sec>2</read_bytes_<wbr>sec><br>
> 18:04:10 </iotune><br>
> 18:04:10 </disk><br>
><br>
> Seems that this test is not using assertXMLEqual so we don't get meaningful<br>
> error like the tests above.<br>
<br>
Fixed the reporting: <a href="https://gerrit.ovirt.org/65417" rel="noreferrer" target="_blank">https://gerrit.ovirt.org/65417</a><br>
<br>
For the sloppy virt tests, I think the right call is to fix the tests rather than the code. The code is not wrong, because the ordering<br>
of the attributes is not relevant. We "just" need tests which can interpret XML on a deeper level.<br>
<br>
--<br>
Francesco Romani<br>
Red Hat Engineering Virtualization R & D<br>
Phone: 8261328<br>
IRC: fromani<br>
</blockquote></div></div>