From 9be8a6af6df2840819631467ea7c78d021befddd Mon Sep 17 00:00:00 2001 From: Ramil Valitov Date: Tue, 7 Jul 2020 00:22:29 +0300 Subject: [PATCH] WIP tests for commands --- .travis.yml | 3 +++ tests/missing.sh | 4 ---- zabbix/zabbix_php_fpm_discovery.sh | 32 +++++++++++++++--------------- zabbix/zabbix_php_fpm_status.sh | 4 ++-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec63740..51aeef0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,9 @@ jobs: - zabbix-agent before_script: - sudo curl -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2 + - sudo apt-get -y purge jq + - sudo apt-get -y purge libfcgi-bin libfcgi0ldbl + - sudo apt autoremove script: bash tests/missing.sh - os: linux dist: bionic diff --git a/tests/missing.sh b/tests/missing.sh index 5d698ff..8c3bca7 100644 --- a/tests/missing.sh +++ b/tests/missing.sh @@ -17,10 +17,6 @@ oneTimeSetUp() { sudo chmod +x /etc/zabbix/zabbix_php_fpm_discovery.sh sudo chmod +x /etc/zabbix/zabbix_php_fpm_status.sh - sudo apt-get -y purge jq - sudo apt-get -y purge libfcgi-bin libfcgi0ldbl - sudo apt autoremove - echo "All done, starting tests..." } diff --git a/zabbix/zabbix_php_fpm_discovery.sh b/zabbix/zabbix_php_fpm_discovery.sh index ee1d8bb..01d21fe 100644 --- a/zabbix/zabbix_php_fpm_discovery.sh +++ b/zabbix/zabbix_php_fpm_discovery.sh @@ -44,67 +44,67 @@ S_DATE=$(type -P date) S_BC=$(type -P bc) S_SLEEP=$(type -P sleep) -if [[ ! -f $S_PS ]]; then +if [[ ! -x $S_PS ]]; then ${S_ECHO} "Utility 'ps' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_GREP ]]; then +if [[ ! -x $S_GREP ]]; then ${S_ECHO} "Utility 'grep' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_AWK ]]; then +if [[ ! -x $S_AWK ]]; then ${S_ECHO} "Utility 'awk' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_SORT ]]; then +if [[ ! -x $S_SORT ]]; then ${S_ECHO} "Utility 'sort' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_UNIQ ]]; then +if [[ ! -x $S_UNIQ ]]; then ${S_ECHO} "Utility 'uniq' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_HEAD ]]; then +if [[ ! -x $S_HEAD ]]; then ${S_ECHO} "Utility 'head' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_LSOF ]]; then +if [[ ! -x $S_LSOF ]]; then ${S_ECHO} "Utility 'lsof' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_JQ ]]; then +if [[ ! -x $S_JQ ]]; then ${S_ECHO} "Utility 'jq' not found. Please, install it first." exit 1 fi -if [[ ! -f ${S_DIRNAME} ]]; then +if [[ ! -x ${S_DIRNAME} ]]; then ${S_ECHO} "Utility 'dirname' not found. Please, install it first." exit 1 fi -if [[ ! -f ${S_CAT} ]]; then +if [[ ! -x ${S_CAT} ]]; then ${S_ECHO} "Utility 'cat' not found. Please, install it first." exit 1 fi -if [[ ! -f ${S_BASH} ]]; then +if [[ ! -x ${S_BASH} ]]; then ${S_ECHO} "Utility 'bash' not found. Please, install it first." exit 1 fi -if [[ ! -f ${S_PRINTF} ]]; then +if [[ ! -x ${S_PRINTF} ]]; then ${S_ECHO} "Utility 'printf' not found. Please, install it first." exit 1 fi -if [[ ! -f ${S_WHOAMI} ]]; then +if [[ ! -x ${S_WHOAMI} ]]; then ${S_ECHO} "Utility 'whoami' not found. Please, install it first." exit 1 fi -if [[ ! -f ${S_DATE} ]]; then +if [[ ! -x ${S_DATE} ]]; then ${S_ECHO} "Utility 'date' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_BC ]]; then +if [[ ! -x $S_BC ]]; then $S_ECHO "Utility 'bc' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_SLEEP ]]; then +if [[ ! -x $S_SLEEP ]]; then $S_ECHO "Utility 'sleep' not found. Please, install it first." exit 1 fi diff --git a/zabbix/zabbix_php_fpm_status.sh b/zabbix/zabbix_php_fpm_status.sh index 65b7249..f9a6b09 100644 --- a/zabbix/zabbix_php_fpm_status.sh +++ b/zabbix/zabbix_php_fpm_status.sh @@ -6,12 +6,12 @@ S_FCGI=$(type -P cgi-fcgi) S_GREP=$(type -P grep) -if [[ ! -f $S_FCGI ]]; then +if [[ ! -x $S_FCGI ]]; then echo "Utility 'cgi-fcgi' not found. Please, install it first." exit 1 fi -if [[ ! -f $S_GREP ]]; then +if [[ ! -x $S_GREP ]]; then echo "Utility 'grep' not found. Please, install it first." exit 1 fi