From 08145ae35787805bbaff08cef368fcf20176e8da Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Jun 02 2012 20:39:23 +0000 Subject: added test for traceroute --- diff --git a/tests/p_tcpdump/0_install_tcpdump.sh b/tests/p_tcpdump/0_install_tcpdump.sh index ccf1308..5436056 100755 --- a/tests/p_tcpdump/0_install_tcpdump.sh +++ b/tests/p_tcpdump/0_install_tcpdump.sh @@ -1,6 +1,6 @@ #!/bin/bash # Author: Christoph Galuschka -# Install tcpdump +t_Log "Running $0 - install package tcpdump" t_InstallPackage tcpdump diff --git a/tests/p_traceroute/0-install_traceroute.sh b/tests/p_traceroute/0-install_traceroute.sh new file mode 100755 index 0000000..e14bca8 --- /dev/null +++ b/tests/p_traceroute/0-install_traceroute.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - installing package traceroute" +t_InstallPackage traceroute + diff --git a/tests/p_traceroute/traceroute_test.sh b/tests/p_traceroute/traceroute_test.sh new file mode 100755 index 0000000..1cabd06 --- /dev/null +++ b/tests/p_traceroute/traceroute_test.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - running traceroute to webhost" + +# Testing availability of network +SKIP_QA_HARNESS=1 +if [ $SKIP_QA_HARNESS ]; then + HOST="www.centos.org" +else + HOST="repo.centos.qa" +fi + +ping -q -c 5 -i 0.25 ${HOST} +if [ $? = 0 ] +then + t_Log "$HOST is available - continuing" + COUNT=$( traceroute ${HOST} | grep -c ${HOST} ) + if [ $COUNT = 2 ] + then + t_Log "traceroute reached ${HOST} and nslookup seems to work, too" + ret_val=0 + else + t_Log "traceroute didn't reach ${HOST}" + ret_val=1 + fi +else + t_Log "$HOST seems to be unavailable - skipping" + ret_val=0 +fi + +t_CheckExitStatus $ret_val