Add a test case to witness how duplicate sections are handled.

Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---
 .../duplicate-sections.conf                   | 43 ++++++++++++
 .../duplicate-sections.conf                   | 68 +++++++++++++++++++
 test/run_parse_config_tests.pl                |  2 +-
 3 files changed, 112 insertions(+), 1 deletion(-)
 create mode 100644 test/parse-config-expected/duplicate-sections.conf
 create mode 100644 test/parse-config-input/duplicate-sections.conf

diff --git a/test/parse-config-expected/duplicate-sections.conf 
b/test/parse-config-expected/duplicate-sections.conf
new file mode 100644
index 00000000..1cb7a88a
--- /dev/null
+++ b/test/parse-config-expected/duplicate-sections.conf
@@ -0,0 +1,43 @@
+boot: order=scsi0
+cores: 2
+cpu: x86-64-v2-AES
+ide2: lvm:vm-120-cloudinit,media=cdrom
+ipconfig0: ip=dhcp,ip6=dhcp
+memory: 4096
+meta: creation-qemu=9.0.2,ctime=1725975013
+name: deb122
+net0: vmxnet3=BC:24:11:2C:69:EC,bridge=vnet0,firewall=1
+numa: 0
+ostype: l26
+parent: foo
+scsi0: nfs:120/vm-120-disk-0.qcow2,iothread=1,size=4G
+scsihw: virtio-scsi-single
+smbios1: uuid=b3247ab1-1fe6-428e-965b-08a1b64a8746
+sockets: 1
+unused0: rbd:vm-120-disk-0
+vmgenid: 7079e97c-50e3-4079-afe7-23e67566b946
+
+[PENDING]
+vga: qxl
+
+[special:cloudinit]
+name: deb123
+
+[foo]
+boot: order=scsi0
+cores: 4
+cpu: host
+ide2: lvm:vm-120-cloudinit,media=cdrom
+ipconfig0: ip=dhcp,ip6=dhcp
+memory: 4096
+meta: creation-qemu=9.0.2,ctime=1725975013
+name: deb1223
+net0: vmxnet3=BC:24:11:2C:69:EC,bridge=vnet0,firewall=1
+numa: 0
+ostype: l26
+scsi0: nfs:120/vm-120-disk-0.qcow2,iothread=1,size=4G
+scsihw: virtio-scsi-single
+smbios1: uuid=b3247ab1-1fe6-428e-965b-08a1b64a8746
+snaptime: 1737548747
+sockets: 1
+vmgenid: 7079e97c-50e3-4079-afe7-23e67566b946
diff --git a/test/parse-config-input/duplicate-sections.conf 
b/test/parse-config-input/duplicate-sections.conf
new file mode 100644
index 00000000..41e90e37
--- /dev/null
+++ b/test/parse-config-input/duplicate-sections.conf
@@ -0,0 +1,68 @@
+boot: order=scsi0
+cores: 2
+cpu: x86-64-v2-AES
+ide2: lvm:vm-120-cloudinit,media=cdrom
+ipconfig0: ip=dhcp,ip6=dhcp
+memory: 4096
+meta: creation-qemu=9.0.2,ctime=1725975013
+name: deb122
+net0: vmxnet3=BC:24:11:2C:69:EC,bridge=vnet0,firewall=1
+numa: 0
+ostype: l26
+parent: foo
+scsi0: nfs:120/vm-120-disk-0.qcow2,iothread=1,size=4G
+scsihw: virtio-scsi-single
+smbios1: uuid=b3247ab1-1fe6-428e-965b-08a1b64a8746
+sockets: 1
+unused0: rbd:vm-120-disk-0
+vmgenid: 7079e97c-50e3-4079-afe7-23e67566b946
+
+[PENDING]
+bios: ovmf
+
+[PENDING]
+vga: qxl
+
+[special:cloudinit]
+name: deb12
+
+[special:cloudinit]
+name: deb123
+
+[foo]
+boot: order=scsi0
+cores: 2
+cpu: x86-64-v2-AES
+ide2: lvm:vm-120-cloudinit,media=cdrom
+ipconfig0: ip=dhcp,ip6=dhcp
+memory: 4096
+meta: creation-qemu=9.0.2,ctime=1725975013
+name: deb1223
+net0: vmxnet3=BC:24:11:2C:69:EC,bridge=vnet0,firewall=1
+numa: 0
+ostype: l26
+scsi0: nfs:120/vm-120-disk-0.qcow2,iothread=1,size=4G
+scsihw: virtio-scsi-single
+smbios1: uuid=b3247ab1-1fe6-428e-965b-08a1b64a8746
+snaptime: 1737548747
+sockets: 1
+vmgenid: 7079e97c-50e3-4079-afe7-23e67566b946
+
+[foo]
+boot: order=scsi0
+cores: 4
+cpu: host
+ide2: lvm:vm-120-cloudinit,media=cdrom
+ipconfig0: ip=dhcp,ip6=dhcp
+memory: 4096
+meta: creation-qemu=9.0.2,ctime=1725975013
+name: deb1223
+net0: vmxnet3=BC:24:11:2C:69:EC,bridge=vnet0,firewall=1
+numa: 0
+ostype: l26
+scsi0: nfs:120/vm-120-disk-0.qcow2,iothread=1,size=4G
+scsihw: virtio-scsi-single
+smbios1: uuid=b3247ab1-1fe6-428e-965b-08a1b64a8746
+snaptime: 1737548747
+sockets: 1
+vmgenid: 7079e97c-50e3-4079-afe7-23e67566b946
diff --git a/test/run_parse_config_tests.pl b/test/run_parse_config_tests.pl
index b1a9a0c1..bc7ad86e 100755
--- a/test/run_parse_config_tests.pl
+++ b/test/run_parse_config_tests.pl
@@ -26,7 +26,7 @@ my $OUTPUT_DIR = './parse-config-output';
 my $EXPECTED_DIR = './parse-config-expected';
 
 # NOTE update when you add/remove tests
-plan tests => 2 * 8;
+plan tests => 2 * 9;
 
 sub run_tests {
     my ($strict) = @_;
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to