diff --git a/tests/0_lib/functions.sh b/tests/0_lib/functions.sh index 87137a7..ff87c62 100755 --- a/tests/0_lib/functions.sh +++ b/tests/0_lib/functions.sh @@ -114,6 +114,20 @@ function t_GetArch rpm -q --queryformat '%{arch}\n' centos-release } +function t_CheckForPort +{ + while true + do + sleep 1 + >/dev/null 2>&1 >/dev/tcp/localhost/$1 + if [ "$?" = "0" ] ; then + t_Log "Waiting for tcp port $1 to be listening ..." + break + fi + done + +} + function t_Assert { $@ >/dev/null 2>&1 @@ -136,6 +150,7 @@ export -f t_GetPkgRel export -f t_DistCheck export -f t_GetPkgVer export -f t_GetArch +export -f t_CheckForPort export -f t_Assert export -f t_Assert_Equals export centos_ver diff --git a/tests/p_squid/0-install_squid.sh b/tests/p_squid/0-install_squid.sh index fa22001..4ba3691 100755 --- a/tests/p_squid/0-install_squid.sh +++ b/tests/p_squid/0-install_squid.sh @@ -8,3 +8,5 @@ t_InstallPackage squid echo "127.0.0.1 `hostname`" >> /etc/hosts service squid restart +t_CheckForPort 3128 +