[node-patches] Change in ovirt-node[master]: test: Add igor testcases for network and mounts
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Wed Jun 26 13:44:15 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: test: Add igor testcases for network and mounts
......................................................................
test: Add igor testcases for network and mounts
The ai_extended.suite now includes the extended.set which was created
and contains
verify_network_setup.sh - A testcases which looks at /etc/defaults/ovirt
and verifies that the devices are configured accordingly.
check_common_mounts.sh - A testcases which cheks that well-known mounts
like /var/log and /data are mounted correctly to e.g. HostVG-Logging
and HostVG-Data.
The purpose of this tests is to disocver integration problems and
regressions from a high-level view.
Change-Id: I1dd13d8594150d1a9f2093de039bc7d47ff6cf35
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
A tests/igor/sets/extended.set
M tests/igor/suites/ai_extended.suite
A tests/igor/tcs/check_common_mounts.sh
A tests/igor/tcs/verify_network_setup.sh
4 files changed, 128 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/17/16117/1
diff --git a/tests/igor/sets/extended.set b/tests/igor/sets/extended.set
new file mode 100644
index 0000000..d346e49
--- /dev/null
+++ b/tests/igor/sets/extended.set
@@ -0,0 +1,13 @@
+---
+description: 'Inlcude the common library'
+libs: ['../libs/common']
+searchpath: '../tcs'
+
+
+---
+filename: 'check_common_mounts.sh'
+
+---
+filename: 'verify_network_setup.sh'
+
+---
diff --git a/tests/igor/suites/ai_extended.suite b/tests/igor/suites/ai_extended.suite
index 6cce744..3d8cffd 100644
--- a/tests/igor/suites/ai_extended.suite
+++ b/tests/igor/suites/ai_extended.suite
@@ -9,6 +9,7 @@
sets:
- 'after_auto_install.set'
- 'basic.set'
+ - 'extended.set'
- 'reboot.set'
- 'services.set'
- 'python.set'
diff --git a/tests/igor/tcs/check_common_mounts.sh b/tests/igor/tcs/check_common_mounts.sh
new file mode 100644
index 0000000..987da2b
--- /dev/null
+++ b/tests/igor/tcs/check_common_mounts.sh
@@ -0,0 +1,31 @@
+#!/bin/bash -x
+
+#
+# Verify that the network is configured correctly
+#
+
+igor_highlight() { echo "== $1 ==" ; }
+igor_debug() { echo "[D] $@" ; }
+
+COMMONLIB=${IGOR_LIBDIR}/common/common.sh
+[[ -e $COMMONLIB ]] && . $COMMONLIB
+
+igor_highlight "Checking for well-known mount points" "="
+
+target_has_sources() {
+ target=$1
+ shift 1
+ sources=$@
+ igor_debug "Checking target '$target' for '$sources'"
+ for source in $sources;
+ do
+ igor_debug "Checking '$source'"
+ findmnt "$target" | egrep "^$target\s+$source" || return 1
+ done
+}
+
+igor_highlight "Check that /var/log is mounted correctly"
+target_has_sources "/var/log" ".*HostVG-Logging" "none.*tmpfs"
+
+igor_highlight "Check that /data is mounted correctly"
+target_has_sources "/data" ".*HostVG-Data"
diff --git a/tests/igor/tcs/verify_network_setup.sh b/tests/igor/tcs/verify_network_setup.sh
new file mode 100644
index 0000000..3eeab84
--- /dev/null
+++ b/tests/igor/tcs/verify_network_setup.sh
@@ -0,0 +1,83 @@
+#!/bin/bash -x
+
+#
+# Verify that the network is configured correctly
+# The intention is to verify the runtime informations (devices and addresses)
+# And to not rely on configuration files
+#
+
+igor_highlight() { echo "== $1 ==" ; }
+igor_debug() { echo "[D] $@" ; }
+die() { echo "ERROR: $@" ; exit 1 ; }
+
+COMMONLIB=${IGOR_LIBDIR}/common/common.sh
+[[ -e $COMMONLIB ]] && . $COMMONLIB
+
+igor_highlight "Verifying network setup" "="
+
+
+source /etc/default/ovirt
+
+if [[ -n $OVIRT_BOND_NAME ]];
+then
+ igor_highlight "Verify creation of configured bond devices"
+ set -e
+
+ igor_debug "Checking that '$OVIRT_BOND_NAME' is a bond device"
+ test -e "/sys/class/net/$OVIRT_BOND_NAME/bonding/slaves"
+
+ igor_debug "Checking that all slaves '$OVIRT_BOND_SLAVES' are members"
+ [[ -z $OVIRT_BOND_SLAVES ]] && die "No bond slaves given"
+ for slave in ${OVIRT_BOND_SLAVES/,/ };
+ do
+ igor_debug "Checking slave '$slave'"
+ egrep -q "^$slave| $slave | $slave\$" \
+ /sys/class/net/$OVIRT_BOND_NAME/bonding/slaves
+ done
+
+ igor_debug "Checking that options '$OVIRT_BOND_OPTIONS' are used"
+ for arg in $OVIRT_BOND_OPTIONS;
+ do
+ key=${arg%%=*};
+ value=${arg##*=};
+ fn="/sys/class/net/${OVIRT_BOND_NAME}/bonding/$key"
+ igor_debug "Checking '$arg' is in '$fn'"
+ real_value=$(cat $fn | cut -d" " -f1)
+ if [[ $real_value != $value ]];
+ then
+ igor_debug " Failed: '$real_value' != '$value'"
+ exit 1
+ fi
+ done
+
+ igor_debug "Bond link status:"
+ ip link show $OVIRT_BOND_NAME
+fi
+
+
+if [[ -n $OVIRT_BOOTIF ]]
+then
+ igor_highlight "Checking bootif '$OVIRT_BOOTIF' configuration"
+ if [[ -z $OVIRT_NETWORK_LAYOUT || $OVIRT_NETWORK_LAYOUT == "direct" ]];
+ then
+ igor_highlight "Checking direct network layout"
+ # FIXME how to?
+ elif [[ -n $OVIRT_NETWORK_LAYOUT && $OVIRT_NETWORK_LAYOUT == "bridged" ]]
+ then
+ igor_highlight "Checking bridged network layout"
+ else
+ igor_highlight "Unknown network layout: $OVIRT_NETWORK_LAYOUT"
+ exit 1
+ fi
+
+ if [[ -n $OVIRT_IP_ADDR ]];
+ then
+ igor_debug "Checking for static IP address"
+ ip link show $OVIRT_BOOTIF
+ elif [[ -n $OVIRT_BOOTPROTO && $OVIRT_BOOTPROTO == "dhcp" ]];
+ then
+ igor_debug "Checking for dhcp lease"
+ # FIXME this assumes that this file exists ... and not done differnt
+ ls /var/lib/dhclient/*${OVIRT_BOOTIF}.lease
+ fi
+fi
--
To view, visit http://gerrit.ovirt.org/16117
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1dd13d8594150d1a9f2093de039bc7d47ff6cf35
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list