----- Original Message -----
From: "Nir Soffer" <nsoffer(a)redhat.com>
To: "devel" <devel(a)ovirt.org>, "Adam Litke"
<alitke(a)redhat.com>, "Dan Kenigsberg" <danken(a)redhat.com>,
"Francesco
Romani" <fromani(a)redhat.com>, "Piotr Kliczewski"
<pkliczew(a)redhat.com>, "Martin Sivak" <msivak(a)redhat.com>
Sent: Wednesday, October 12, 2016 8:14:11 PM
Subject: [VDSM] Tests failing because of ordering dependencies
Hi all,
Trying to run vdsm tests via tox (so correct nose is used automatically),
some of the tests fail.
The failure are all about ordering expectations, which look wrong.
Please check and fix your tests.
Thanks,
Nir
18:04:10 -------------------- >> begin captured logging
<<
--------------------
18:04:10 2016-10-12 18:01:56,902 INFO (MainThread) [MOM] Preparing
MOM interface (momIF:49)
18:04:10 2016-10-12 18:01:56,903 INFO (MainThread) [MOM] Using
named unix socket /tmp/tmpqOQZvm/test_mom_vdsm.sock (momIF:58)
18:04:10 --------------------- >> end captured logging <<
---------------------
18:04:10
18:04:10
======================================================================
18:04:10 FAIL: test_disk_virtio_cache (vmStorageTests.DriveXMLTests)
18:04:10
----------------------------------------------------------------------
18:04:10 Traceback (most recent call last):
18:04:10 File
"/home/jenkins/workspace/vdsm_master_check-patch-el7-x86_64/vdsm/tests/vmStorageTests.py",
line 84, in test_disk_virtio_cache
18:04:10 self.check(vm_conf, conf, xml, is_block_device=False)
18:04:10 File
"/home/jenkins/workspace/vdsm_master_check-patch-el7-x86_64/vdsm/tests/vmStorageTests.py",
line 222, in check
18:04:10 self.assertXMLEqual(drive.getXML().toxml(), xml)
18:04:10 File
"/home/jenkins/workspace/vdsm_master_check-patch-el7-x86_64/vdsm/tests/testlib.py",
line 253, in assertXMLEqual
18:04:10 (actualXML, expectedXML))
18:04:10 AssertionError: XMLs are different:
18:04:10 Actual:
18:04:10 <disk device="disk" snapshot="no"
type="file">
18:04:10 <source file="/path/to/volume" />
18:04:10 <target bus="virtio" dev="vda" />
18:04:10 <shareable />
18:04:10 <serial>54-a672-23e5b495a9ea</serial>
18:04:10 <driver cache="writethrough" error_policy="enospace"
io="threads" name="qemu" type="qcow2" />
18:04:10 <iotune>
18:04:10 <total_iops_sec>800</total_iops_sec>
18:04:10 <read_bytes_sec>6120000</read_bytes_sec>
18:04:10 </iotune>
18:04:10 </disk>
18:04:10
18:04:10 Expected:
18:04:10 <disk device="disk" snapshot="no"
type="file">
18:04:10 <source file="/path/to/volume" />
18:04:10 <target bus="virtio" dev="vda" />
18:04:10 <shareable />
18:04:10 <serial>54-a672-23e5b495a9ea</serial>
18:04:10 <driver cache="writethrough" error_policy="enospace"
io="threads" name="qemu" type="qcow2" />
18:04:10 <iotune>
18:04:10 <read_bytes_sec>6120000</read_bytes_sec>
18:04:10 <total_iops_sec>800</total_iops_sec>
Order of these elements differ, need to check why.
Most likely because we build the xml like
(vdsm/virt/vmdevices/storage.py)
def _getIotuneXML(self):
iotune = vmxml.Element('iotune')
for key, value in self.specParams['ioTune'].iteritems():
iotune.appendChildWithArgs(key, text=str(value))
return iotune
and iteritems() ordering is not defined
----------------------------------------------------------------------
18:04:10 Traceback (most recent call last):
18:04:10 File
"/home/jenkins/workspace/vdsm_master_check-patch-el7-x86_64/vdsm/tests/vmTests.py",
line 434, in testCpuXML
18:04:10 self.assertXMLEqual(find_xml_element(xml, "./cputune"),
cputuneXML)
18:04:10 File
"/home/jenkins/workspace/vdsm_master_check-patch-el7-x86_64/vdsm/tests/testlib.py",
line 253, in assertXMLEqual
18:04:10 (actualXML, expectedXML))
18:04:10 AssertionError: XMLs are different:
18:04:10 Actual:
18:04:10 <cputune>
18:04:10 <vcpupin cpuset="0-1" vcpu="0" />
18:04:10 <vcpupin cpuset="2-3" vcpu="1" />
18:04:10 </cputune>
18:04:10
18:04:10 Expected:
18:04:10 <cputune>
18:04:10 <vcpupin cpuset="2-3" vcpu="1" />
18:04:10 <vcpupin cpuset="0-1" vcpu="0" />
Same
(vdsm/virt/vmxml.py)
def appendCpus(self):
# lot of code
# CPU-pinning support
# see
http://www.ovirt.org/wiki/Features/Design/cpu-pinning
if 'cpuPinning' in self.conf:
cputune = Element('cputune')
cpuPinning = self.conf.get('cpuPinning')
for cpuPin in cpuPinning.keys():
cputune.appendChildWithArgs('vcpupin', vcpu=cpuPin,
cpuset=cpuPinning[cpuPin])
self.dom.appendChild(cputune)
18:04:10 </cputune>
18:04:10
18:04:10
18:04:10
18:04:10
======================================================================
18:04:10 FAIL: testSetIoTune (vmTests.TestVm)
18:04:10
----------------------------------------------------------------------
18:04:10 Traceback (most recent call last):
18:04:10 File
"/home/jenkins/workspace/vdsm_master_check-patch-el7-x86_64/vdsm/tests/vmTests.py",
line 936, in testSetIoTune
18:04:10 self._xml_sanitizer(expected_xml))
18:04:10 AssertionError: '<disk device="hdd" snapshot="no"
type="block"><source dev="/dev/dummy"/><target
bus="ide"
dev="hda"/><iotune><write_bytes_sec>1</write_bytes_sec><total_bytes_sec>0</total_bytes_sec><read_bytes_sec>2</read_bytes_sec></iotune></disk>'
!= '<disk device="hdd" snapshot="no"
type="block"><source
dev="/dev/dummy"/><target bus="ide"
dev="hda"/><iotune><read_bytes_sec>2</read_bytes_sec><write_bytes_sec>1</write_bytes_sec><total_bytes_sec>0</total_bytes_sec></iotune></disk>'
18:04:10 -------------------- >> begin captured logging <<
--------------------
18:04:10 2016-10-12 18:03:34,110 INFO (MainThread) [virt.vm]
vmId=`TESTING`::New device XML for hda: <disk device="hdd"
snapshot="no" type="block">
18:04:10 <source dev="/dev/dummy"/>
18:04:10 <target bus="ide" dev="hda"/>
18:04:10 <iotune>
18:04:10 <write_bytes_sec>1</write_bytes_sec>
18:04:10 <total_bytes_sec>0</total_bytes_sec>
18:04:10 <read_bytes_sec>2</read_bytes_sec>
18:04:10 </iotune>
18:04:10 </disk>
Seems that this test is not using assertXMLEqual so we don't get meaningful
error like the tests above.
Fixed the reporting:
https://gerrit.ovirt.org/65417
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
of the attributes is not relevant. We "just" need tests which can interpret XML
on a deeper level.
--
Francesco Romani
Red Hat Engineering Virtualization R & D
Phone: 8261328
IRC: fromani