summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-02-21 16:09:14 -0500
committerScott Moser <smoser@ubuntu.com>2018-02-21 19:13:28 -0500
commitb7497e807fa12a26d4a12aaf1ee9302a4fd24728 (patch)
treec7921169381921ac7a7becc0ec9e6595bea0e8b6 /tests
parent99171fb7b9bec446e25a338a0d36a820844fbc2d (diff)
downloadvyos-cloud-init-b7497e807fa12a26d4a12aaf1ee9302a4fd24728.tar.gz
vyos-cloud-init-b7497e807fa12a26d4a12aaf1ee9302a4fd24728.zip
ds-identify: Fix searching for iso9660 OVF cdroms.
This fixes a bug in parsing of 'blkid -o export' output. The result of the bug meant that DI_ISO9660_DEVS did not get set correctly and is_cdrom_ovf would not identify devices in most cases. The tests are improved to demonstrate both multiple iso devices and also a cdrom that doesn't sort "last" in blkid output. The code change is to use DEVNAME as the record separator when parsing blkid -o export rather than relying on being able to read the empty line. LP: #1749980
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_ds_identify.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py
index 03942de0..21258347 100644
--- a/tests/unittests/test_ds_identify.py
+++ b/tests/unittests/test_ds_identify.py
@@ -350,8 +350,10 @@ class TestDsIdentify(CiTestCase):
"OVFENV", "ovfenv"]
for valid_ovf_label in valid_ovf_labels:
ovf_cdrom_by_label['mocks'][0]['out'] = blkid_out([
+ {'DEVNAME': 'sda1', 'TYPE': 'ext4', 'LABEL': 'rootfs'},
{'DEVNAME': 'sr0', 'TYPE': 'iso9660',
- 'LABEL': valid_ovf_label}])
+ 'LABEL': valid_ovf_label},
+ {'DEVNAME': 'vda1', 'TYPE': 'ntfs', 'LABEL': 'data'}])
self._check_via_dict(
ovf_cdrom_by_label, rc=RC_FOUND, dslist=['OVF', DS_NONE])
@@ -513,8 +515,9 @@ VALID_CFG = {
'mocks': [
{'name': 'blkid', 'ret': 0,
'out': blkid_out(
- [{'DEVNAME': 'vda1', 'TYPE': 'vfat', 'PARTUUID': uuid4()},
- {'DEVNAME': 'sr0', 'TYPE': 'iso9660', 'LABEL': ''}])
+ [{'DEVNAME': 'sr0', 'TYPE': 'iso9660', 'LABEL': ''},
+ {'DEVNAME': 'sr1', 'TYPE': 'iso9660', 'LABEL': 'ignoreme'},
+ {'DEVNAME': 'vda1', 'TYPE': 'vfat', 'PARTUUID': uuid4()}]),
},
MOCK_VIRT_IS_VMWARE,
],