[PATCH 2/2] tests: Add tests for <leasetime/> to cover dnsmasq settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



New tests are required to cover some new XML syntax entry for
<leasetime/> option. This includes schema testing and other features
like unit attribute and leasetime value.

Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
---
 tests/networkxml2confdata/leasetime-hours.conf   | 16 ++++++++++++++++
 tests/networkxml2confdata/leasetime-hours.xml    | 12 ++++++++++++
 .../networkxml2confdata/leasetime-infinite.conf  | 16 ++++++++++++++++
 tests/networkxml2confdata/leasetime-infinite.xml | 12 ++++++++++++
 tests/networkxml2confdata/leasetime-minutes.conf | 16 ++++++++++++++++
 tests/networkxml2confdata/leasetime-minutes.xml  | 12 ++++++++++++
 tests/networkxml2confdata/leasetime-seconds.conf | 16 ++++++++++++++++
 tests/networkxml2confdata/leasetime-seconds.xml  | 12 ++++++++++++
 tests/networkxml2conftest.c                      |  4 ++++
 tests/networkxml2xmlin/leasetime-hours.xml       | 12 ++++++++++++
 tests/networkxml2xmlin/leasetime-infinite.xml    | 12 ++++++++++++
 tests/networkxml2xmlin/leasetime-minutes.xml     | 12 ++++++++++++
 tests/networkxml2xmlin/leasetime-seconds.xml     | 12 ++++++++++++
 tests/networkxml2xmlout/leasetime-hours.xml      | 14 ++++++++++++++
 tests/networkxml2xmlout/leasetime-infinite.xml   | 14 ++++++++++++++
 tests/networkxml2xmlout/leasetime-minutes.xml    | 14 ++++++++++++++
 tests/networkxml2xmlout/leasetime-seconds.xml    | 14 ++++++++++++++
 tests/networkxml2xmltest.c                       |  4 ++++
 18 files changed, 224 insertions(+)
 create mode 100644 tests/networkxml2confdata/leasetime-hours.conf
 create mode 100644 tests/networkxml2confdata/leasetime-hours.xml
 create mode 100644 tests/networkxml2confdata/leasetime-infinite.conf
 create mode 100644 tests/networkxml2confdata/leasetime-infinite.xml
 create mode 100644 tests/networkxml2confdata/leasetime-minutes.conf
 create mode 100644 tests/networkxml2confdata/leasetime-minutes.xml
 create mode 100644 tests/networkxml2confdata/leasetime-seconds.conf
 create mode 100644 tests/networkxml2confdata/leasetime-seconds.xml
 create mode 100644 tests/networkxml2xmlin/leasetime-hours.xml
 create mode 100644 tests/networkxml2xmlin/leasetime-infinite.xml
 create mode 100644 tests/networkxml2xmlin/leasetime-minutes.xml
 create mode 100644 tests/networkxml2xmlin/leasetime-seconds.xml
 create mode 100644 tests/networkxml2xmlout/leasetime-hours.xml
 create mode 100644 tests/networkxml2xmlout/leasetime-infinite.xml
 create mode 100644 tests/networkxml2xmlout/leasetime-minutes.xml
 create mode 100644 tests/networkxml2xmlout/leasetime-seconds.xml

diff --git a/tests/networkxml2confdata/leasetime-hours.conf b/tests/networkxml2confdata/leasetime-hours.conf
new file mode 100644
index 0000000000..1599d4633e
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-hours.conf
@@ -0,0 +1,16 @@
+##WARNING:  THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST.  Changes to this configuration should be made using:
+##    virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,1h
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/leasetime-hours.xml b/tests/networkxml2confdata/leasetime-hours.xml
new file mode 100644
index 0000000000..8df196e84e
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-hours.xml
@@ -0,0 +1,12 @@
+<network xmlns:dnsmasq="http://libvirt.org/schemas/network/dnsmasq/1.0";>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime unit="hours">1</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime-infinite.conf b/tests/networkxml2confdata/leasetime-infinite.conf
new file mode 100644
index 0000000000..883ced6ade
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-infinite.conf
@@ -0,0 +1,16 @@
+##WARNING:  THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST.  Changes to this configuration should be made using:
+##    virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,infinite
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/leasetime-infinite.xml b/tests/networkxml2confdata/leasetime-infinite.xml
new file mode 100644
index 0000000000..9ae3c4f7f7
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-infinite.xml
@@ -0,0 +1,12 @@
+<network xmlns:dnsmasq="http://libvirt.org/schemas/network/dnsmasq/1.0";>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime unit="infinite"/>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime-minutes.conf b/tests/networkxml2confdata/leasetime-minutes.conf
new file mode 100644
index 0000000000..c093501a35
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-minutes.conf
@@ -0,0 +1,16 @@
+##WARNING:  THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST.  Changes to this configuration should be made using:
+##    virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,10m
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/leasetime-minutes.xml b/tests/networkxml2confdata/leasetime-minutes.xml
new file mode 100644
index 0000000000..e531db2848
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-minutes.xml
@@ -0,0 +1,12 @@
+<network xmlns:dnsmasq="http://libvirt.org/schemas/network/dnsmasq/1.0";>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime unit="minutes">10</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime-seconds.conf b/tests/networkxml2confdata/leasetime-seconds.conf
new file mode 100644
index 0000000000..4acc2839c5
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-seconds.conf
@@ -0,0 +1,16 @@
+##WARNING:  THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST.  Changes to this configuration should be made using:
+##    virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,1000s
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/leasetime-seconds.xml b/tests/networkxml2confdata/leasetime-seconds.xml
new file mode 100644
index 0000000000..4b4a57110e
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-seconds.xml
@@ -0,0 +1,12 @@
+<network xmlns:dnsmasq="http://libvirt.org/schemas/network/dnsmasq/1.0";>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime>1000</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index a8355272b9..3cb6658f51 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -142,6 +142,10 @@ mymain(void)
     DO_TEST("dhcp6host-routed-network", dhcpv6);
     DO_TEST("ptr-domains-auto", dhcpv6);
     DO_TEST("dnsmasq-options", dhcpv6);
+    DO_TEST("leasetime-seconds", full);
+    DO_TEST("leasetime-minutes", full);
+    DO_TEST("leasetime-hours", full);
+    DO_TEST("leasetime-infinite", full);
 
     virObjectUnref(dhcpv6);
     virObjectUnref(full);
diff --git a/tests/networkxml2xmlin/leasetime-hours.xml b/tests/networkxml2xmlin/leasetime-hours.xml
new file mode 100644
index 0000000000..d8075111a4
--- /dev/null
+++ b/tests/networkxml2xmlin/leasetime-hours.xml
@@ -0,0 +1,12 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime unit="hours">1</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmlin/leasetime-infinite.xml b/tests/networkxml2xmlin/leasetime-infinite.xml
new file mode 100644
index 0000000000..d0357620b0
--- /dev/null
+++ b/tests/networkxml2xmlin/leasetime-infinite.xml
@@ -0,0 +1,12 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime unit="infinite"/>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmlin/leasetime-minutes.xml b/tests/networkxml2xmlin/leasetime-minutes.xml
new file mode 100644
index 0000000000..21169766a4
--- /dev/null
+++ b/tests/networkxml2xmlin/leasetime-minutes.xml
@@ -0,0 +1,12 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime unit="minutes">10</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmlin/leasetime-seconds.xml b/tests/networkxml2xmlin/leasetime-seconds.xml
new file mode 100644
index 0000000000..4cf64b851e
--- /dev/null
+++ b/tests/networkxml2xmlin/leasetime-seconds.xml
@@ -0,0 +1,12 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <bridge name="virbr0"/>
+  <forward mode="nat" dev="eth1"/>
+  <ip address="192.168.122.1" netmask="255.255.255.0">
+    <dhcp>
+      <range start="192.168.122.2" end="192.168.122.254"/>
+      <leasetime unit="seconds">200</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmlout/leasetime-hours.xml b/tests/networkxml2xmlout/leasetime-hours.xml
new file mode 100644
index 0000000000..ed85f77569
--- /dev/null
+++ b/tests/networkxml2xmlout/leasetime-hours.xml
@@ -0,0 +1,14 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <forward dev='eth1' mode='nat'>
+    <interface dev='eth1'/>
+  </forward>
+  <bridge name='virbr0' stp='on' delay='0'/>
+  <ip address='192.168.122.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.122.2' end='192.168.122.254'/>
+      <leasetime unit='hours'>1</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmlout/leasetime-infinite.xml b/tests/networkxml2xmlout/leasetime-infinite.xml
new file mode 100644
index 0000000000..4373357588
--- /dev/null
+++ b/tests/networkxml2xmlout/leasetime-infinite.xml
@@ -0,0 +1,14 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <forward dev='eth1' mode='nat'>
+    <interface dev='eth1'/>
+  </forward>
+  <bridge name='virbr0' stp='on' delay='0'/>
+  <ip address='192.168.122.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.122.2' end='192.168.122.254'/>
+      <leasetime unit='infinite'/>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmlout/leasetime-minutes.xml b/tests/networkxml2xmlout/leasetime-minutes.xml
new file mode 100644
index 0000000000..9e3d8591fa
--- /dev/null
+++ b/tests/networkxml2xmlout/leasetime-minutes.xml
@@ -0,0 +1,14 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <forward dev='eth1' mode='nat'>
+    <interface dev='eth1'/>
+  </forward>
+  <bridge name='virbr0' stp='on' delay='0'/>
+  <ip address='192.168.122.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.122.2' end='192.168.122.254'/>
+      <leasetime unit='minutes'>10</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmlout/leasetime-seconds.xml b/tests/networkxml2xmlout/leasetime-seconds.xml
new file mode 100644
index 0000000000..a4e428f84b
--- /dev/null
+++ b/tests/networkxml2xmlout/leasetime-seconds.xml
@@ -0,0 +1,14 @@
+<network>
+  <name>default</name>
+  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+  <forward dev='eth1' mode='nat'>
+    <interface dev='eth1'/>
+  </forward>
+  <bridge name='virbr0' stp='on' delay='0'/>
+  <ip address='192.168.122.1' netmask='255.255.255.0'>
+    <dhcp>
+      <range start='192.168.122.2' end='192.168.122.254'/>
+      <leasetime unit='seconds'>200</leasetime>
+    </dhcp>
+  </ip>
+</network>
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index ec679e72ee..700744785a 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -160,6 +160,10 @@ mymain(void)
     DO_TEST("metadata");
     DO_TEST("set-mtu");
     DO_TEST("dnsmasq-options");
+    DO_TEST("leasetime-seconds");
+    DO_TEST("leasetime-minutes");
+    DO_TEST("leasetime-hours");
+    DO_TEST("leasetime-infinite");
     DO_TEST("isolated-ports");
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
-- 
2.24.1






[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux