From 42d405ce2aa639bae18f030f2d34c4e8844869fa Mon Sep 17 00:00:00 2001 From: Ramil Valitov Date: Mon, 6 Jul 2020 00:18:23 +0300 Subject: [PATCH] [add] test missing packages --- tests/all.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/all.sh b/tests/all.sh index cc50d9c..15b1baa 100644 --- a/tests/all.sh +++ b/tests/all.sh @@ -226,7 +226,7 @@ testZabbixDiscoverNumberOfPortPools() { assertEquals "Number of pools mismatch" "$PHP_COUNT" "$NUMBER_OF_POOLS" } -#This test should be last +#This test should be last in Zabbix tests testZabbixDiscoverTimeout() { #Create lots of pools MAX_POOLS=100 @@ -236,5 +236,25 @@ testZabbixDiscoverTimeout() { testZabbixDiscoverReturnsData } +################################# +#The following tests should be last, no tests of actual data should be done afterwards + +testMissingPackagesDiscoveryScript() { + sudo apt-get -y purge jq + + DATA=$(sudo bash "/etc/zabbix/zabbix_php_fpm_discovery.sh" "/php-fpm-status") + IS_OK=$(echo "$DATA" | grep -F ' not found.') + assertNotNull "Discovery script didn't report error on missing utility 'jq'" +} + +testMissingPackagesStatusScript() { + sudo apt-get -y purge libfcgi-bin libfcgi0ldbl + + PHP_POOL=$(getAnySocket) + DATA=$(sudo bash "/etc/zabbix/zabbix_php_fpm_status.sh" "$PHP_POOL" "/php-fpm-status") + IS_OK=$(echo "$DATA" | grep -F ' not found.') + assertNotNull "Status script didn't report error on missing utility 'cgi-fcgi'" +} + # Load shUnit2. . shunit2