Skip to content

Commit decbb50

Browse files
authored
Merge pull request #12 from ydirson/improve-test-coverage
Improve test coverage
2 parents 08e1cd3 + 056238e commit decbb50

32 files changed

+718
-124
lines changed

tests/data/all_ethN.biosdevname

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
BIOS device: eth0
2+
Kernel name: eth0
3+
Permanent MAC: EC:F4:BB:C3:AF:A8
4+
Assigned MAC : EC:F4:BB:C3:AF:A8
5+
Driver: ixgbe
6+
Driver version: 5.9.4
7+
Firmware version: 0x8000095c, 19.5.12
8+
Bus Info: 0000:01:00.0
9+
PCI name : 0000:01:00.0
10+
PCI Slot : embedded
11+
SMBIOS Device Type: Ethernet
12+
SMBIOS Instance: 1
13+
SMBIOS Label: Integrated NIC 1
14+
sysfs Label: NIC1
15+
Embedded Index: 1
16+
17+
BIOS device: eth1
18+
Kernel name: eth1
19+
Permanent MAC: EC:F4:BB:C3:AF:AA
20+
Assigned MAC : EC:F4:BB:C3:AF:AA
21+
Driver: ixgbe
22+
Driver version: 5.9.4
23+
Firmware version: 0x8000095c, 19.5.12
24+
Bus Info: 0000:01:00.1
25+
PCI name : 0000:01:00.1
26+
PCI Slot : embedded
27+
SMBIOS Device Type: Ethernet
28+
SMBIOS Instance: 2
29+
SMBIOS Label: Integrated NIC 2
30+
sysfs Label: NIC2
31+
Embedded Index: 2
32+
33+
BIOS device: eth2
34+
Kernel name: eth2
35+
Permanent MAC: EC:F4:BB:C3:AF:AC
36+
Assigned MAC : EC:F4:BB:C3:AF:AC
37+
Driver: igb
38+
Driver version: 5.3.5.20
39+
Firmware version: 1.67, 0x80000fab, 19.5.12
40+
Bus Info: 0000:07:00.0
41+
PCI name : 0000:07:00.0
42+
PCI Slot : embedded
43+
SMBIOS Device Type: Ethernet
44+
SMBIOS Instance: 3
45+
SMBIOS Label: Integrated NIC 3
46+
sysfs Label: NIC3
47+
VPD Port: 3
48+
VPD Index: 1
49+
VPD PCI master: 0000:07:00.0
50+
51+
BIOS device: eth3
52+
Kernel name: eth3
53+
Permanent MAC: EC:F4:BB:C3:AF:AD
54+
Assigned MAC : EC:F4:BB:C3:AF:AD
55+
Driver: igb
56+
Driver version: 5.3.5.20
57+
Firmware version: 1.67, 0x80000fab, 19.5.12
58+
Bus Info: 0000:07:00.1
59+
PCI name : 0000:07:00.1
60+
PCI Slot : embedded
61+
SMBIOS Device Type: Ethernet
62+
SMBIOS Instance: 4
63+
SMBIOS Label: Integrated NIC 4
64+
sysfs Label: NIC4
65+
VPD Port: 4
66+
VPD Index: 1
67+
VPD PCI master: 0000:07:00.1
68+

tests/data/grub-linux.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set default=0
2+
menuentry 'linux' {
3+
linux /boot/vmlinuz-1 ro
4+
initrd /boot/initrd.img-1
5+
}

tests/data/grub.cfg

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
serial --unit=0 --speed=115200
2+
terminal_input serial console
3+
terminal_output serial console
4+
set default=0
5+
set timeout=5
6+
menuentry 'XCP-ng' {
7+
search --label --set root root-vgdorj
8+
multiboot2 /boot/xen.gz dom0_mem=7584M,max:7584M watchdog ucode=scan dom0_max_vcpus=1-16 crashkernel=256M,below=4G console=vga vga=mode-0x0311
9+
module2 /boot/vmlinuz-4.19-xen root=LABEL=root-vgdorj ro nolvm hpet=disable console=hvc0 console=tty0 quiet vga=785 splash plymouth.ignore-serial-consoles
10+
module2 /boot/initrd-4.19-xen.img
11+
}
12+
menuentry 'XCP-ng (Serial)' {
13+
search --label --set root root-vgdorj
14+
multiboot2 /boot/xen.gz com1=115200,8n1 console=com1,vga dom0_mem=7584M,max:7584M watchdog ucode=scan dom0_max_vcpus=1-16 crashkernel=256M,below=4G
15+
module2 /boot/vmlinuz-4.19-xen root=LABEL=root-vgdorj ro nolvm hpet=disable console=tty0 console=hvc0
16+
module2 /boot/initrd-4.19-xen.img
17+
}
18+
menuentry 'XCP-ng in Safe Mode' {
19+
search --label --set root root-vgdorj
20+
multiboot2 /boot/xen.gz nosmp noreboot noirqbalance no-mce no-bootscrub no-numa no-hap no-mmcfg max_cstate=0 nmi=ignore allow_unsafe dom0_mem=7584M,max:7584M com1=115200,8n1 console=com1,vga
21+
module2 /boot/vmlinuz-4.19-xen earlyprintk=xen root=LABEL=root-vgdorj ro nolvm hpet=disable console=tty0 console=hvc0
22+
module2 /boot/initrd-4.19-xen.img
23+
}
24+
menuentry 'XCP-ng (Xen 4.13.1 / Linux 4.19.0+1)' {
25+
search --label --set root root-vgdorj
26+
multiboot2 /boot/xen-fallback.gz dom0_mem=7584M,max:7584M watchdog ucode=scan dom0_max_vcpus=1-16 crashkernel=256M,below=4G
27+
module2 /boot/vmlinuz-fallback root=LABEL=root-vgdorj ro nolvm hpet=disable console=hvc0 console=tty0
28+
module2 /boot/initrd-fallback.img
29+
}
30+
menuentry 'XCP-ng (Serial, Xen 4.13.1 / Linux 4.19.0+1)' {
31+
search --label --set root root-vgdorj
32+
multiboot2 /boot/xen-fallback.gz com1=115200,8n1 console=com1,vga dom0_mem=7584M,max:7584M watchdog ucode=scan dom0_max_vcpus=1-16 crashkernel=256M,below=4G
33+
module2 /boot/vmlinuz-fallback root=LABEL=root-vgdorj ro nolvm hpet=disable console=tty0 console=hvc0
34+
module2 /boot/initrd-fallback.img
35+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
PRIMARY_DISK='/dev/disk/by-id/scsi-123456789012345678901234567899012'
2+
PRODUCT_VERSION='8.2.1'
3+
DOM0_VCPUS='16'
4+
CONTROL_DOMAIN_UUID='3b1dccee-9da4-49c6-8250-e3725e0e4b2d'
5+
DOM0_MEM='7584'
6+
COMPANY_NAME_SHORT='Open Source'
7+
MANAGEMENT_ADDRESS_TYPE='IPv4'
8+
PARTITION_LAYOUT='ROOT,BACKUP,LOG,BOOT,SWAP,SR'
9+
PRODUCT_VERSION_TEXT='8.2'
10+
PRODUCT_BRAND='XCP-ng'
11+
INSTALLATION_UUID='b8b63475-d28c-44d4-9d1e-c38298ad3a0d'
12+
PRODUCT_VERSION_TEXT_SHORT='8.2'
13+
BRAND_CONSOLE='XCP-ng Center'
14+
PRODUCT_NAME='xenenterprise'
15+
MANAGEMENT_INTERFACE='xapi1'
16+
COMPANY_PRODUCT_BRAND='XCP-ng'
17+
PLATFORM_VERSION='3.2.1'
18+
BUILD_NUMBER='release/yangtze/master/58'
19+
PLATFORM_NAME='XCP'
20+
BRAND_CONSOLE_URL='https://xcp-ng.org'
21+
BACKUP_PARTITION='/dev/disk/by-id/scsi-123456789012345678901234567899012-part2'
22+
INSTALLATION_DATE='2021-08-03 16:39:24.077945'
23+
COMPANY_NAME='Open Source'

tests/data/lspci-mn

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
00:00.0 "0600" "1022" "1630" "1022" "1630"
2+
00:00.2 "0806" "1022" "1631" "1022" "1631"
3+
00:01.0 "0600" "1022" "1632" "" ""
4+
00:01.1 "0604" "1022" "1633" "" ""
5+
00:02.0 "0600" "1022" "1632" "" ""
6+
00:02.1 "0604" "1022" "1634" "" ""
7+
00:02.2 "0604" "1022" "1634" "" ""
8+
00:02.3 "0604" "1022" "1634" "" ""
9+
00:08.0 "0600" "1022" "1632" "" ""
10+
00:08.1 "0604" "1022" "1635" "" ""
11+
00:08.2 "0604" "1022" "1635" "" ""
12+
00:14.0 "0c05" "1022" "790b" -r51 "1462" "12ac"
13+
00:14.3 "0601" "1022" "790e" -r51 "1462" "12ac"
14+
00:18.0 "0600" "1022" "1448" "" ""
15+
00:18.1 "0600" "1022" "1449" "" ""
16+
00:18.2 "0600" "1022" "144a" "" ""
17+
00:18.3 "0600" "1022" "144b" "" ""
18+
00:18.4 "0600" "1022" "144c" "" ""
19+
00:18.5 "0600" "1022" "144d" "" ""
20+
00:18.6 "0600" "1022" "144e" "" ""
21+
00:18.7 "0600" "1022" "144f" "" ""
22+
01:00.0 "0604" "1002" "1478" -rc1 "" ""
23+
02:00.0 "0604" "1002" "1479" "" ""
24+
03:00.0 "0380" "1002" "7340" -rc1 "1462" "12ac"
25+
03:00.1 "0403" "1002" "ab38" "1462" "12ac"
26+
04:00.0 "0280" "8086" "2723" -r1a "8086" "0084"
27+
05:00.0 "0200" "10ec" "8168" -r15 "1462" "12ac"
28+
06:00.0 "0108" "144d" "a808" -p02 "144d" "a801"
29+
07:00.0 "0300" "1002" "1636" -rc6 "1462" "12ac"
30+
07:00.2 "1080" "1022" "15df" "1022" "15df"
31+
07:00.3 "0c03" "1022" "1639" -p30 "1462" "12ac"
32+
07:00.4 "0c03" "1022" "1639" -p30 "1462" "12ac"
33+
07:00.5 "0480" "1022" "15e2" -r01 "1462" "12ac"
34+
07:00.6 "0403" "1022" "15e3" "1462" "12ac"
35+
08:00.0 "0106" "1022" "7901" -r81 -p01 "1462" "12ac"
36+
08:00.1 "0106" "1022" "7901" -r81 -p01 "1462" "12ac"

tests/data/pci.ids

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Excerpt from /usr/share/hwdata/pci.ids
2+
3+
# Vendors, devices and subsystems. Please keep sorted.
4+
5+
# Syntax:
6+
# vendor vendor_name
7+
# device device_name <-- single tab
8+
# subvendor subdevice subsystem_name <-- two tabs
9+
10+
1002 Advanced Micro Devices, Inc. [AMD/ATI]
11+
1314 Wrestler HDMI Audio
12+
174b 1001 PURE Fusion Mini
13+
1636 Renoir
14+
7340 Navi 14 [Radeon RX 5500/5500M / Pro 5500M]
15+
16+
# List of known device classes, subclasses and programming interfaces
17+
18+
# Syntax:
19+
# C class class_name
20+
# subclass subclass_name <-- single tab
21+
# prog-if prog-if_name <-- two tabs
22+
23+
C 03 Display controller
24+
00 VGA compatible controller
25+
00 VGA controller
26+
01 8514 controller
27+
01 XGA compatible controller
28+
02 3D controller
29+
80 Display controller

tests/data/physical.biosdevname

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
BIOS device: em1
2+
Kernel name: eth0
3+
Permanent MAC: EC:F4:BB:C3:AF:A8
4+
Assigned MAC : EC:F4:BB:C3:AF:A8
5+
Driver: ixgbe
6+
Driver version: 5.9.4
7+
Firmware version: 0x8000095c, 19.5.12
8+
Bus Info: 0000:01:00.0
9+
PCI name : 0000:01:00.0
10+
PCI Slot : embedded
11+
SMBIOS Device Type: Ethernet
12+
SMBIOS Instance: 1
13+
SMBIOS Label: Integrated NIC 1
14+
sysfs Label: NIC1
15+
Embedded Index: 1
16+
17+
BIOS device: em2
18+
Kernel name: eth1
19+
Permanent MAC: EC:F4:BB:C3:AF:AA
20+
Assigned MAC : EC:F4:BB:C3:AF:AA
21+
Driver: ixgbe
22+
Driver version: 5.9.4
23+
Firmware version: 0x8000095c, 19.5.12
24+
Bus Info: 0000:01:00.1
25+
PCI name : 0000:01:00.1
26+
PCI Slot : embedded
27+
SMBIOS Device Type: Ethernet
28+
SMBIOS Instance: 2
29+
SMBIOS Label: Integrated NIC 2
30+
sysfs Label: NIC2
31+
Embedded Index: 2
32+
33+
BIOS device: em3_1
34+
Kernel name: eth2
35+
Permanent MAC: EC:F4:BB:C3:AF:AC
36+
Assigned MAC : EC:F4:BB:C3:AF:AC
37+
Driver: igb
38+
Driver version: 5.3.5.20
39+
Firmware version: 1.67, 0x80000fab, 19.5.12
40+
Bus Info: 0000:07:00.0
41+
PCI name : 0000:07:00.0
42+
PCI Slot : embedded
43+
SMBIOS Device Type: Ethernet
44+
SMBIOS Instance: 3
45+
SMBIOS Label: Integrated NIC 3
46+
sysfs Label: NIC3
47+
VPD Port: 3
48+
VPD Index: 1
49+
VPD PCI master: 0000:07:00.0
50+
51+
BIOS device: em4_1
52+
Kernel name: eth3
53+
Permanent MAC: EC:F4:BB:C3:AF:AD
54+
Assigned MAC : EC:F4:BB:C3:AF:AD
55+
Driver: igb
56+
Driver version: 5.3.5.20
57+
Firmware version: 1.67, 0x80000fab, 19.5.12
58+
Bus Info: 0000:07:00.1
59+
PCI name : 0000:07:00.1
60+
PCI Slot : embedded
61+
SMBIOS Device Type: Ethernet
62+
SMBIOS Instance: 4
63+
SMBIOS Label: Integrated NIC 4
64+
sysfs Label: NIC4
65+
VPD Port: 4
66+
VPD Index: 1
67+
VPD PCI master: 0000:07:00.1
68+

tests/data/repo/.treeinfo

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[platform]
2+
name = XCP
3+
version = 3.2.1
4+
5+
[branding]
6+
name = XCP-ng
7+
version = 8.2.1
8+
9+
[build]
10+
number = release/yangtze/master/58
11+
12+
[keys]
13+
key1 = RPM-GPG-KEY-CH-8
14+
key2 = RPM-GPG-KEY-CH-8-LCM
15+
key3 = RPM-GPG-KEY-Platform-V1
16+
17+
[general]
18+
name = XCP-ng-8.2.1
19+
family = XCP-ng
20+
timestamp = 1645700813.00
21+
variant =
22+
version = 8.2.1
23+
packagedir =
24+
arch = x86_64
25+
26+
[images-x86_64]
27+
kernel = boot/pxelinux/mboot.c32
28+
initrd = boot/vmlinuz
29+
boot.iso = boot/xen.gz
30+
31+
[images-xen]
32+
kernel = boot/pxelinux/mboot.c32
33+
initrd = boot/vmlinuz
34+

tests/data/repo/XS-PACKAGES

Whitespace-only changes.

tests/data/repo/XS-REPOSITORY

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<repository
2+
originator="o"
3+
name="n"
4+
product="p"
5+
version="12.3"
6+
build="42"
7+
>
8+
9+
<description>
10+
Description
11+
</description>
12+
13+
<requires name="dep" test="ge" version="1" />
14+
</repository>

tests/data/repo/XS-REPOSITORY-LIST

Whitespace-only changes.

tests/data/repo/repodata/repomd.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<repomd xmlns="http://linux.duke.edu/metadata/repo" xmlns:rpm="http://linux.duke.edu/metadata/rpm">
3+
<revision>1645708616</revision>
4+
<data type="primary">
5+
<checksum type="sha256">f8454f26592a0669368825d673edc18a067d8a434f2d3ceaa03cdb45e72572e8</checksum>
6+
<open-checksum type="sha256">6f2d69e90edbe7b3eb83654995dc07c6e577d8fc2f9ee7ec7f4f206ed486218b</open-checksum>
7+
<location href="repodata/f8454f26592a0669368825d673edc18a067d8a434f2d3ceaa03cdb45e72572e8-primary.xml.gz"/>
8+
<timestamp>1645708616</timestamp>
9+
<size>208220</size>
10+
<open-size>1449213</open-size>
11+
</data>
12+
<data type="filelists">
13+
<checksum type="sha256">4e678f6ce4fc197faef2c75645d00c79ee8b70d3210aa2f692fe432ed223c695</checksum>
14+
<open-checksum type="sha256">cea7a040a15876aba2238f3b8910cd48ded102ff0d4976df81903a3bc4ae8586</open-checksum>
15+
<location href="repodata/4e678f6ce4fc197faef2c75645d00c79ee8b70d3210aa2f692fe432ed223c695-filelists.xml.gz"/>
16+
<timestamp>1645708616</timestamp>
17+
<size>265582</size>
18+
<open-size>2704673</open-size>
19+
</data>
20+
<data type="other">
21+
<checksum type="sha256">a19f12f68c74459bc9fc7887376408b4c8dc9e84876ebbf3301afec79f110a7b</checksum>
22+
<open-checksum type="sha256">46a83a4100e33249a95462d7ed54cb71ee4a178db8f2346b83f1ba5f1a5d47dc</open-checksum>
23+
<location href="repodata/a19f12f68c74459bc9fc7887376408b4c8dc9e84876ebbf3301afec79f110a7b-other.xml.gz"/>
24+
<timestamp>1645708616</timestamp>
25+
<size>204512</size>
26+
<open-size>1054253</open-size>
27+
</data>
28+
<data type="primary_db">
29+
<checksum type="sha256">34a89554a4214fde5b473ddcf1d9be796801e8e8676cda860a3d032a7e8b10d8</checksum>
30+
<open-checksum type="sha256">1fc99d5403906556e8fc91d2121816354cac667741f1a04f51988b5cc3e01b98</open-checksum>
31+
<location href="repodata/34a89554a4214fde5b473ddcf1d9be796801e8e8676cda860a3d032a7e8b10d8-primary.sqlite.bz2"/>
32+
<timestamp>1645708616</timestamp>
33+
<size>419050</size>
34+
<open-size>1754112</open-size>
35+
<database_version>10</database_version>
36+
</data>
37+
<data type="filelists_db">
38+
<checksum type="sha256">f4c416c2cf253741749420300109cf8a046e0cdd27c269e69795a9ecc092669b</checksum>
39+
<open-checksum type="sha256">1de3d29150b9da80b10c95b913c91369f3b7d03bb2ed57eedf511038e4537c50</open-checksum>
40+
<location href="repodata/f4c416c2cf253741749420300109cf8a046e0cdd27c269e69795a9ecc092669b-filelists.sqlite.bz2"/>
41+
<timestamp>1645708616</timestamp>
42+
<size>323942</size>
43+
<open-size>1380352</open-size>
44+
<database_version>10</database_version>
45+
</data>
46+
<data type="other_db">
47+
<checksum type="sha256">4a192c51fff556d2f1fdbb8f90b5454558c910a50674e65b7cdfacd5f791fdb5</checksum>
48+
<open-checksum type="sha256">23dbdc6ce9ece7f1d3ac3d7b31cd61b4019e96ef01903975516fd5e3083de32a</open-checksum>
49+
<location href="repodata/4a192c51fff556d2f1fdbb8f90b5454558c910a50674e65b7cdfacd5f791fdb5-other.sqlite.bz2"/>
50+
<timestamp>1645708616</timestamp>
51+
<size>243295</size>
52+
<open-size>988160</open-size>
53+
<database_version>10</database_version>
54+
</data>
55+
</repomd>

tests/test_accessor.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import unittest
2+
3+
import xcp.accessor
4+
5+
class TestAccessor(unittest.TestCase):
6+
def test_http(self):
7+
raise unittest.SkipTest("comment out if you really mean it")
8+
a = xcp.accessor.createAccessor("https://updates.xcp-ng.org/netinstall/8.2.1", True)
9+
a.start()
10+
self.assertTrue(a.access('.treeinfo'))
11+
self.assertFalse(a.access('no_such_file'))
12+
self.assertEqual(a.lastError, 404)
13+
a.finish()
14+
15+
def test_file(self):
16+
a = xcp.accessor.createAccessor("file://tests/data/repo/", True)
17+
a.start()
18+
self.assertTrue(a.access('.treeinfo'))
19+
self.assertFalse(a.access('no_such_file'))
20+
self.assertEqual(a.lastError, 404)
21+
a.finish()

0 commit comments

Comments
 (0)