[PATCH master] Add tests for network --device missing and --device=link

Radek Vykydal rvykydal at redhat.com
Mon Jun 1 09:24:49 UTC 2015


Tests for #1085310

These are only for one one NIC available.
I am wondering what resources we'll need to run kickstart
tests if only for this issue (and for one NIC case only) I created
seven tests. Which made me think whether unit tests wouldn't be
more appropriate here. They would be harder to write.
And we also want to check that the ks ifcfg file is not only generated
but also not overwritten by dracut ifcfg file. And in one of the tests
we want to check that ksdevice is honored as default --device (actually
Jiri has a patch making this work), so perhaps really integration tests.
---
 tests/kickstart_tests/device-link.ks               | 44 +++++++++++++++++++++
 tests/kickstart_tests/device-link.sh               | 20 ++++++++++
 tests/kickstart_tests/device-missing.ks            | 45 ++++++++++++++++++++++
 tests/kickstart_tests/device-missing.sh            | 20 ++++++++++
 tests/kickstart_tests/hostname-device-missing.ks   | 45 ++++++++++++++++++++++
 tests/kickstart_tests/hostname-device-missing.sh   | 20 ++++++++++
 .../hostname-equals-device-missing.ks              | 45 ++++++++++++++++++++++
 .../hostname-equals-device-missing.sh              | 20 ++++++++++
 tests/kickstart_tests/hostname-equals-only.ks      | 45 ++++++++++++++++++++++
 tests/kickstart_tests/hostname-equals-only.sh      | 20 ++++++++++
 tests/kickstart_tests/hostname-only-ksdevice.ks    | 45 ++++++++++++++++++++++
 tests/kickstart_tests/hostname-only-ksdevice.sh    | 24 ++++++++++++
 tests/kickstart_tests/hostname-only.ks             | 45 ++++++++++++++++++++++
 tests/kickstart_tests/hostname-only.sh             | 20 ++++++++++
 14 files changed, 458 insertions(+)
 create mode 100644 tests/kickstart_tests/device-link.ks
 create mode 100755 tests/kickstart_tests/device-link.sh
 create mode 100644 tests/kickstart_tests/device-missing.ks
 create mode 100755 tests/kickstart_tests/device-missing.sh
 create mode 100644 tests/kickstart_tests/hostname-device-missing.ks
 create mode 100755 tests/kickstart_tests/hostname-device-missing.sh
 create mode 100644 tests/kickstart_tests/hostname-equals-device-missing.ks
 create mode 100755 tests/kickstart_tests/hostname-equals-device-missing.sh
 create mode 100644 tests/kickstart_tests/hostname-equals-only.ks
 create mode 100755 tests/kickstart_tests/hostname-equals-only.sh
 create mode 100644 tests/kickstart_tests/hostname-only-ksdevice.ks
 create mode 100755 tests/kickstart_tests/hostname-only-ksdevice.sh
 create mode 100644 tests/kickstart_tests/hostname-only.ks
 create mode 100755 tests/kickstart_tests/hostname-only.sh

diff --git a/tests/kickstart_tests/device-link.ks b/tests/kickstart_tests/device-link.ks
new file mode 100644
index 0000000..a120280
--- /dev/null
+++ b/tests/kickstart_tests/device-link.ks
@@ -0,0 +1,44 @@
+#version=DEVEL
+url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/"
+install
+
+# Assuming single NIC
+# Using vnc via boot options causes this device to be activated in dracut
+# We are overriding the configuration by kickstart (with the same dhcp)
+# in dracut, parse-kickstart
+network --bootproto=dhcp --device=link
+
+bootloader --timeout=1
+zerombr
+clearpart --all --initlabel
+autopart
+
+keyboard us
+lang en_US.UTF-8
+timezone America/New_York --utc
+rootpw testcase
+shutdown
+
+%packages
+%end
+
+%post
+
+result=1
+for filename in /etc/sysconfig/network-scripts/ifcfg-*; do
+    if [ "$filename" == "/etc/sysconfig/network-scripts/ifcfg-lo" ]; then
+        continue
+    fi
+    grep -q "Generated by parse-kickstart" $filename
+    if [ $? -eq 0 ]; then
+        result=0
+    fi
+done
+
+if [ $result -eq 0 ]; then
+    echo SUCCESS > /root/RESULT
+else
+    echo '*** device was not configured by kickstart in dracut for --device=link' > /root/RESULT
+fi
+
+%end
diff --git a/tests/kickstart_tests/device-link.sh b/tests/kickstart_tests/device-link.sh
new file mode 100755
index 0000000..7b2f4f0
--- /dev/null
+++ b/tests/kickstart_tests/device-link.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+. ${KSTESTDIR}/functions.sh
diff --git a/tests/kickstart_tests/device-missing.ks b/tests/kickstart_tests/device-missing.ks
new file mode 100644
index 0000000..fe78952
--- /dev/null
+++ b/tests/kickstart_tests/device-missing.ks
@@ -0,0 +1,45 @@
+#version=DEVEL
+url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/"
+install
+
+# Assuming single NIC.
+# Using vnc via boot options causes this device to be activated in dracut.
+# We are overriding the configuration by kickstart (with the same dhcp)
+# in dracut, parse-kickstart.
+# No ksdevice is supplied, so --device=link is assumed.
+network --bootproto=dhcp
+
+bootloader --timeout=1
+zerombr
+clearpart --all --initlabel
+autopart
+
+keyboard us
+lang en_US.UTF-8
+timezone America/New_York --utc
+rootpw testcase
+shutdown
+
+%packages
+%end
+
+%post
+
+result=1
+for filename in /etc/sysconfig/network-scripts/ifcfg-*; do
+    if [ "$filename" == "/etc/sysconfig/network-scripts/ifcfg-lo" ]; then
+        continue
+    fi
+    grep -q "Generated by parse-kickstart" $filename
+    if [ $? -eq 0 ]; then
+        result=0
+    fi
+done
+
+if [ $result -eq 0 ]; then
+    echo SUCCESS > /root/RESULT
+else
+    echo '*** device was not configured by kickstart in dracut for missing --device' > /root/RESULT
+fi
+
+%end
diff --git a/tests/kickstart_tests/device-missing.sh b/tests/kickstart_tests/device-missing.sh
new file mode 100755
index 0000000..7b2f4f0
--- /dev/null
+++ b/tests/kickstart_tests/device-missing.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+. ${KSTESTDIR}/functions.sh
diff --git a/tests/kickstart_tests/hostname-device-missing.ks b/tests/kickstart_tests/hostname-device-missing.ks
new file mode 100644
index 0000000..68e3916
--- /dev/null
+++ b/tests/kickstart_tests/hostname-device-missing.ks
@@ -0,0 +1,45 @@
+#version=DEVEL
+url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/"
+install
+
+# Assuming single NIC.
+# Using vnc via boot options causes this device to be activated in dracut.
+# We are overriding the configuration by kickstart (with the same dhcp)
+# in dracut, parse-kickstart.
+# This is not hosname only configuration, default (--device=link) device should be configured.
+network --bootproto dhcp --activate
+
+bootloader --timeout=1
+zerombr
+clearpart --all --initlabel
+autopart
+
+keyboard us
+lang en_US.UTF-8
+timezone America/New_York --utc
+rootpw testcase
+shutdown
+
+%packages
+%end
+
+%post
+
+result=1
+for filename in /etc/sysconfig/network-scripts/ifcfg-*; do
+    if [ "$filename" == "/etc/sysconfig/network-scripts/ifcfg-lo" ]; then
+        continue
+    fi
+    grep -q "Generated by parse-kickstart" $filename
+    if [ $? -eq 0 ]; then
+        result=0
+    fi
+done
+
+if [ $result -eq 0 ]; then
+    echo SUCCESS > /root/RESULT
+else
+    echo '*** device was not configured by kickstart in dracut for missing --device' > /root/RESULT
+fi
+
+%end
diff --git a/tests/kickstart_tests/hostname-device-missing.sh b/tests/kickstart_tests/hostname-device-missing.sh
new file mode 100755
index 0000000..7b2f4f0
--- /dev/null
+++ b/tests/kickstart_tests/hostname-device-missing.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+. ${KSTESTDIR}/functions.sh
diff --git a/tests/kickstart_tests/hostname-equals-device-missing.ks b/tests/kickstart_tests/hostname-equals-device-missing.ks
new file mode 100644
index 0000000..648ff35
--- /dev/null
+++ b/tests/kickstart_tests/hostname-equals-device-missing.ks
@@ -0,0 +1,45 @@
+#version=DEVEL
+url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/"
+install
+
+# Assuming single NIC.
+# Using vnc via boot options causes this device to be activated in dracut.
+# We are overriding the configuration by kickstart (with the same dhcp)
+# in dracut, parse-kickstart.
+# This is not hosname only configuration, default (--device=link) device should be configured.
+network --bootproto=dhcp --activate
+
+bootloader --timeout=1
+zerombr
+clearpart --all --initlabel
+autopart
+
+keyboard us
+lang en_US.UTF-8
+timezone America/New_York --utc
+rootpw testcase
+shutdown
+
+%packages
+%end
+
+%post
+
+result=1
+for filename in /etc/sysconfig/network-scripts/ifcfg-*; do
+    if [ "$filename" == "/etc/sysconfig/network-scripts/ifcfg-lo" ]; then
+        continue
+    fi
+    grep -q "Generated by parse-kickstart" $filename
+    if [ $? -eq 0 ]; then
+        result=0
+    fi
+done
+
+if [ $result -eq 0 ]; then
+    echo SUCCESS > /root/RESULT
+else
+    echo '*** device was not configured by kickstart in dracut for missing --device' > /root/RESULT
+fi
+
+%end
diff --git a/tests/kickstart_tests/hostname-equals-device-missing.sh b/tests/kickstart_tests/hostname-equals-device-missing.sh
new file mode 100755
index 0000000..7b2f4f0
--- /dev/null
+++ b/tests/kickstart_tests/hostname-equals-device-missing.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+. ${KSTESTDIR}/functions.sh
diff --git a/tests/kickstart_tests/hostname-equals-only.ks b/tests/kickstart_tests/hostname-equals-only.ks
new file mode 100644
index 0000000..eaa0333
--- /dev/null
+++ b/tests/kickstart_tests/hostname-equals-only.ks
@@ -0,0 +1,45 @@
+#version=DEVEL
+url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/"
+install
+
+# Assuming single NIC.
+# Using vnc via boot options causes this device to be activated in dracut.
+# We are overriding the configuration by kickstart (with the same dhcp)
+# in dracut, parse-kickstart.
+# No ksdevice is supplied, so don't configure any device.
+network --hostname=blah
+
+bootloader --timeout=1
+zerombr
+clearpart --all --initlabel
+autopart
+
+keyboard us
+lang en_US.UTF-8
+timezone America/New_York --utc
+rootpw testcase
+shutdown
+
+%packages
+%end
+
+%post
+
+result=0
+for filename in /etc/sysconfig/network-scripts/ifcfg-*; do
+    if [ "$filename" == "/etc/sysconfig/network-scripts/ifcfg-lo" ]; then
+        continue
+    fi
+    grep -q "Generated by parse-kickstart" $filename
+    if [ $? -eq 0 ]; then
+        result=1
+    fi
+done
+
+if [ $result -eq 0 ]; then
+    echo SUCCESS > /root/RESULT
+else
+    echo '*** device was conifgured by kickstart in dracut for hostname only configuration' > /root/RESULT
+fi
+
+%end
diff --git a/tests/kickstart_tests/hostname-equals-only.sh b/tests/kickstart_tests/hostname-equals-only.sh
new file mode 100755
index 0000000..7b2f4f0
--- /dev/null
+++ b/tests/kickstart_tests/hostname-equals-only.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+. ${KSTESTDIR}/functions.sh
diff --git a/tests/kickstart_tests/hostname-only-ksdevice.ks b/tests/kickstart_tests/hostname-only-ksdevice.ks
new file mode 100644
index 0000000..c2ba9f3
--- /dev/null
+++ b/tests/kickstart_tests/hostname-only-ksdevice.ks
@@ -0,0 +1,45 @@
+#version=DEVEL
+url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/"
+install
+
+# Assuming single NIC.
+# Using vnc via boot options causes this device to be activated in dracut.
+# We are overriding the configuration by kickstart (with the same dhcp)
+# in dracut, parse-kickstart.
+# ksdevice is supplied, so configure the device.
+network --hostname blah
+
+bootloader --timeout=1
+zerombr
+clearpart --all --initlabel
+autopart
+
+keyboard us
+lang en_US.UTF-8
+timezone America/New_York --utc
+rootpw testcase
+shutdown
+
+%packages
+%end
+
+%post
+
+result=1
+for filename in /etc/sysconfig/network-scripts/ifcfg-*; do
+    if [ "$filename" == "/etc/sysconfig/network-scripts/ifcfg-lo" ]; then
+        continue
+    fi
+    grep -q "Generated by parse-kickstart" $filename
+    if [ $? -eq 0 ]; then
+        result=0
+    fi
+done
+
+if [ $result -eq 0 ]; then
+    echo SUCCESS > /root/RESULT
+else
+    echo '*** device was not conifgured by kickstart in dracut although ksdevice was supplied' > /root/RESULT
+fi
+
+%end
diff --git a/tests/kickstart_tests/hostname-only-ksdevice.sh b/tests/kickstart_tests/hostname-only-ksdevice.sh
new file mode 100755
index 0000000..8c972f7
--- /dev/null
+++ b/tests/kickstart_tests/hostname-only-ksdevice.sh
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+. ${KSTESTDIR}/functions.sh
+
+kernel_args() {
+    echo "vnc ksdevice=link"
+}
diff --git a/tests/kickstart_tests/hostname-only.ks b/tests/kickstart_tests/hostname-only.ks
new file mode 100644
index 0000000..8b8cf57
--- /dev/null
+++ b/tests/kickstart_tests/hostname-only.ks
@@ -0,0 +1,45 @@
+#version=DEVEL
+url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/"
+install
+
+# Assuming single NIC.
+# Using vnc via boot options causes this device to be activated in dracut.
+# We are overriding the configuration by kickstart (with the same dhcp)
+# in dracut, parse-kickstart.
+# No ksdevice is supplied, so don't configure any device.
+network --hostname blah
+
+bootloader --timeout=1
+zerombr
+clearpart --all --initlabel
+autopart
+
+keyboard us
+lang en_US.UTF-8
+timezone America/New_York --utc
+rootpw testcase
+shutdown
+
+%packages
+%end
+
+%post
+
+result=0
+for filename in /etc/sysconfig/network-scripts/ifcfg-*; do
+    if [ "$filename" == "/etc/sysconfig/network-scripts/ifcfg-lo" ]; then
+        continue
+    fi
+    grep -q "Generated by parse-kickstart" $filename
+    if [ $? -eq 0 ]; then
+        result=1
+    fi
+done
+
+if [ $result -eq 0 ]; then
+    echo SUCCESS > /root/RESULT
+else
+    echo '*** device was conifgured by kickstart in dracut for hostname only configuration' > /root/RESULT
+fi
+
+%end
diff --git a/tests/kickstart_tests/hostname-only.sh b/tests/kickstart_tests/hostname-only.sh
new file mode 100755
index 0000000..7b2f4f0
--- /dev/null
+++ b/tests/kickstart_tests/hostname-only.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015  Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+# Public License for more details.  You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+. ${KSTESTDIR}/functions.sh
-- 
1.9.3



More information about the anaconda-patches mailing list