diff --git a/doc/RunningTests b/doc/RunningTests index a9b145a..f873730 100644 --- a/doc/RunningTests +++ b/doc/RunningTests @@ -1,2 +1,5 @@ -To run these tests on your local machine, set SKIP_QA_HARNESS=1 in the bash environment before calling runtests.sh. eg: -SKIP_QA_HARNESS=1 ./runtests.sh +To run these tests on your local machine : +./runtests.sh + +To only run a specific test ( eg. p_openssh ) : +./runtests.sh p_openssh diff --git a/runtests.sh b/runtests.sh index cc592b0..fc9d92b 100755 --- a/runtests.sh +++ b/runtests.sh @@ -5,6 +5,9 @@ echo -e "\n[+] `date` -> CentOS QA $0 starting." +host repo.centos.org > /dev/null +SKIP_QA_HARNESS=$? + LIB_FUNCTIONS='./tests/0_lib/functions.sh' [ -f $LIB_FUNCTIONS ] && source $LIB_FUNCTIONS || { echo -e "\n[+] `date` -> Unable to source functions library. Cannot continue\n"; exit $FAIL; } diff --git a/tests/0_common/00_qa_repo_config.sh b/tests/0_common/00_qa_repo_config.sh index 06f6d70..6e15ad6 100755 --- a/tests/0_common/00_qa_repo_config.sh +++ b/tests/0_common/00_qa_repo_config.sh @@ -1,7 +1,7 @@ #!/bin/bash t_Log "Running $0 - modifying yum repositories for QA purposes." -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 0 ]; then echo 'Skip..' exit 0 fi diff --git a/tests/0_common/30_dns_works.sh b/tests/0_common/30_dns_works.sh index 1c40650..55510b6 100755 --- a/tests/0_common/30_dns_works.sh +++ b/tests/0_common/30_dns_works.sh @@ -1,7 +1,7 @@ #!/bin/bash t_Log "Running $0 - testing to see if DNS works" -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then HOST=wiki.centos.org else HOST=repo.centos.qa diff --git a/tests/p_audit/auditd_running.sh b/tests/p_audit/auditd_running.sh index 182a0c8..bb050cd 100755 --- a/tests/p_audit/auditd_running.sh +++ b/tests/p_audit/auditd_running.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - check if auditd is running." -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then echo "Skipping this test ..." else service auditd status > /dev/null 2>&1 diff --git a/tests/p_curl/curl_test.sh b/tests/p_curl/curl_test.sh index 84e8dab..1ed35d0 100755 --- a/tests/p_curl/curl_test.sh +++ b/tests/p_curl/curl_test.sh @@ -5,7 +5,7 @@ t_Log "Running $0 - curl can access http-host and retrieve index.html." -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then CHECK_FOR="CentOS Wiki" URL="http://wiki.centos.org/" else diff --git a/tests/p_iptables/iptables_default_rules.sh b/tests/p_iptables/iptables_default_rules.sh index dbb0964..c76b64d 100755 --- a/tests/p_iptables/iptables_default_rules.sh +++ b/tests/p_iptables/iptables_default_rules.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - check iptables default rules" -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then echo "Skip, No standard firewall config ..." else diff --git a/tests/p_lftp/10_lftp_http_test.sh b/tests/p_lftp/10_lftp_http_test.sh index 3727c8b..0cb8a2f 100755 --- a/tests/p_lftp/10_lftp_http_test.sh +++ b/tests/p_lftp/10_lftp_http_test.sh @@ -6,7 +6,7 @@ # Christoph Galuschka t_Log "Running $0 - lftp: HTTP test" -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then CHECK_FOR="UTC" URL="http://mirror.centos.org/" FILE="timestamp.txt" diff --git a/tests/p_lynx/lynx_dump_page_test.sh b/tests/p_lynx/lynx_dump_page_test.sh index e6f5c45..ddafa67 100755 --- a/tests/p_lynx/lynx_dump_page_test.sh +++ b/tests/p_lynx/lynx_dump_page_test.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - check that lynx can dump remote page." -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then HOST=wiki.centos.org CHECK_FOR="Page templates" else diff --git a/tests/p_procinfo/5-test_procinfo.sh b/tests/p_procinfo/5-test_procinfo.sh index c011bd7..ed545f0 100755 --- a/tests/p_procinfo/5-test_procinfo.sh +++ b/tests/p_procinfo/5-test_procinfo.sh @@ -10,7 +10,7 @@ then t_Log "It seems to be a CentOS 6.x system, this test will be disabled" exit 0 else - if [ $SKIP_QA_HARNESS ]; then + if [ $SKIP_QA_HARNESS -eq 1 ]; then t_Log "Skip, seems to fail on CI ..." else diff --git a/tests/p_selinux/selinux_enforce.sh b/tests/p_selinux/selinux_enforce.sh index fe5e2af..38fbb49 100755 --- a/tests/p_selinux/selinux_enforce.sh +++ b/tests/p_selinux/selinux_enforce.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - check if SELinux is in enforcing mode" -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then echo "Skipping this test ..." else cat /selinux/enforce | grep 1 > /dev/null 2>&1 diff --git a/tests/p_squid/squid_test.sh b/tests/p_squid/squid_test.sh index b640248..17bb214 100755 --- a/tests/p_squid/squid_test.sh +++ b/tests/p_squid/squid_test.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - Squid test." -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then HOST=wiki.centos.org CHECK_FOR="Page templates" else diff --git a/tests/p_tcpdump/tcpdump_eth0.sh b/tests/p_tcpdump/tcpdump_eth0.sh index c412651..673b514 100755 --- a/tests/p_tcpdump/tcpdump_eth0.sh +++ b/tests/p_tcpdump/tcpdump_eth0.sh @@ -22,7 +22,7 @@ if [[ $IP =~ $regex ]] sleep 1 # reading from file, for each ping we should see two pakets WORKING=$( tcpdump -r $FILE | grep -ci icmp ) - if [ $SKIP_QA_HARNESS ] + if [ $SKIP_QA_HARNESS -eq 1 ] then # treat qa-harness and non qa-harness differently, # the script will always succeed outside qa, but will log results diff --git a/tests/p_traceroute/traceroute_test.sh b/tests/p_traceroute/traceroute_test.sh index 49c104b..c96025c 100755 --- a/tests/p_traceroute/traceroute_test.sh +++ b/tests/p_traceroute/traceroute_test.sh @@ -4,7 +4,7 @@ t_Log "Running $0 - running traceroute to webhost" # Testing availability of network -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then HOST="www.centos.org" else HOST="repo.centos.qa" diff --git a/tests/p_wget/wget_test.sh b/tests/p_wget/wget_test.sh index 3e0a24f..1806ac0 100755 --- a/tests/p_wget/wget_test.sh +++ b/tests/p_wget/wget_test.sh @@ -6,7 +6,7 @@ t_Log "Running $0 - wget can access http-host and download index.html." FILE=/var/tmp/index.html -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then CHECK_FOR="CentOS" URL="http://wiki.centos.org/" else diff --git a/tests/z_repoclosure/repoclosure_test.sh b/tests/z_repoclosure/repoclosure_test.sh index 84ca4fd..37fc2ef 100755 --- a/tests/z_repoclosure/repoclosure_test.sh +++ b/tests/z_repoclosure/repoclosure_test.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - repoclosure test ." -if [ $SKIP_QA_HARNESS ]; then +if [ $SKIP_QA_HARNESS -eq 1 ]; then t_Log "Skip this test in non QA harness environment" else