diff --git a/tests/p_iputils/0-install_iputils.sh b/tests/p_iputils/0-install_iputils.sh new file mode 100755 index 0000000..c5ff56d --- /dev/null +++ b/tests/p_iputils/0-install_iputils.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - installing package iputils" +t_InstallPackage iputils + diff --git a/tests/p_iputils/tracepath_test.sh b/tests/p_iputils/tracepath_test.sh new file mode 100755 index 0000000..2313662 --- /dev/null +++ b/tests/p_iputils/tracepath_test.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Author: Christoph Galuschka + +TEST=tracepath +t_Log "Running $0 - running "${TEST}" to webhost" + +# Testing availability of network +if [ $SKIP_QA_HARNESS -eq 1 ]; then + HOST="www.centos.org" +else + HOST="repo.centos.qa" +fi + +IP=$(ping -qn -c 1 ${HOST} | grep -i 'ping '${HOST}) + +regex='PING\ '${HOST}'\ \(([0-9.]*)\).*' +if [[ $IP =~ $regex ]] +then + t_Log "resolved ${HOST} successfully - continuing" + ping -q -c 2 -i 0.25 ${HOST} + if [ $? = 0 ] + then + t_Log "$HOST is reachable - continuing" + COUNT=$( tracepath -n ${HOST} | grep -c ${BASH_REMATCH[1]} ) + if [ $COUNT = 1 ] + then + t_Log "${TEST} reached ${HOST}" + ret_val=0 + else + t_Log "${TEST} didn't reach ${HOST}" + ret_val=1 + fi + fi +else + t_Log "$HOST seems to be unavailable - skipping" + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_mtr/0-install_mtr.sh b/tests/p_mtr/0-install_mtr.sh new file mode 100755 index 0000000..b386c5e --- /dev/null +++ b/tests/p_mtr/0-install_mtr.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - installing package mtr" +t_InstallPackage mtr + diff --git a/tests/p_mtr/mtr_test.sh b/tests/p_mtr/mtr_test.sh new file mode 100755 index 0000000..d335449 --- /dev/null +++ b/tests/p_mtr/mtr_test.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Author: Christoph Galuschka + +TEST=mtr +t_Log "Running $0 - running "${TEST}" to webhost" + +# Testing availability of network +if [ $SKIP_QA_HARNESS -eq 1 ]; then + HOST="www.centos.org" +else + HOST="repo.centos.qa" +fi + +IP=$(ping -qn -c 1 ${HOST} | grep -i 'ping '${HOST}) + +regex='PING\ '${HOST}'\ \(([0-9.]*)\).*' +if [[ $IP =~ $regex ]] +then + t_Log "resolved ${HOST} successfully - continuing" + ping -q -c 2 -i 0.25 ${HOST} + if [ $? = 0 ] + then + t_Log "$HOST is reachable - continuing" + COUNT=$( mtr -nr -c1 ${HOST} | grep -c ${BASH_REMATCH[1]} ) + if [ $COUNT = 1 ] + then + t_Log "${TEST} reached ${HOST}" + ret_val=0 + else + t_Log "${TEST} didn't reach ${HOST}" + ret_val=1 + fi + fi +else + t_Log "$HOST seems to be unavailable - skipping" + ret_val=0 +fi + +t_CheckExitStatus $ret_val