mirror of
https://github.com/rvalitov/zabbix-php-fpm.git
synced 2023-11-05 03:30:27 +01:00
[add] similar pool names test
This commit is contained in:
parent
13e2e3e6e3
commit
45dbf7de0b
21
tests/all.sh
21
tests/all.sh
@ -54,6 +54,11 @@ setupPools() {
|
||||
done <<<"$PHP_LIST"
|
||||
}
|
||||
|
||||
getNumberOfPHPVersions() {
|
||||
PHP_COUNT=$(find /etc/php/ -name 'www.conf' -type f | wc -l)
|
||||
echo "$PHP_COUNT"
|
||||
}
|
||||
|
||||
getAnySocket() {
|
||||
#Get any socket of PHP-FPM:
|
||||
PHP_FIRST=$(find /etc/php/ -name 'www.conf' -type f | head -n1)
|
||||
@ -150,5 +155,21 @@ testZabbixDiscoverReturnsData() {
|
||||
assertNotNull "Discover script failed: $DATA" "$IS_OK"
|
||||
}
|
||||
|
||||
testZabbixDiscoverSimilarSocketPoolNames() {
|
||||
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
|
||||
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"socket1",' | wc -l)
|
||||
PHP_COUNT=$(getNumberOfPHPVersions)
|
||||
POOLS=$(echo "($PHP_COUNT * $MAX_POOLS)/1" | bc)
|
||||
assertEquals "Found $NUMBER_OF_POOLS pools instead of $POOLS" "$NUMBER_OF_POOLS" "$POOLS"
|
||||
}
|
||||
|
||||
testZabbixDiscoverSimilarHttpPoolNames() {
|
||||
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
|
||||
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"http1",' | wc -l)
|
||||
PHP_COUNT=$(getNumberOfPHPVersions)
|
||||
POOLS=$(echo "($PHP_COUNT * $MAX_POOLS)/1" | bc)
|
||||
assertEquals "Found $NUMBER_OF_POOLS pools instead of $POOLS" "$NUMBER_OF_POOLS" "$POOLS"
|
||||
}
|
||||
|
||||
# Load shUnit2.
|
||||
. shunit2
|
||||
|
Loading…
Reference in New Issue
Block a user