3
0
mirror of https://github.com/rvalitov/zabbix-php-fpm.git synced 2023-11-05 03:30:27 +01:00

Feature/zabbix5 tests + codefactor (#41)

This commit is contained in:
Ramil Valitov 2020-07-03 16:48:27 +03:00 committed by GitHub
parent 3f42afd59a
commit e110535232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 2 deletions

View File

@ -51,6 +51,30 @@ jobs:
- php-fpm
before_script:
- sudo curl -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2
- os: linux
dist: bionic
name: "Zabbix 5.0 @ Ubuntu 18 bionic, PHP default"
arch: amd64
addons:
apt:
sources:
- sourceline: 'deb http://repo.zabbix.com/zabbix/5.0/ubuntu bionic main'
key_url: "https://repo.zabbix.com/zabbix-official-repo.key"
packages:
- ca-certificates
- curl
- grep
- sed
- gawk
- lsof
- jq
- libfcgi-bin
- unzip
- zabbix-agent
- zabbix-get
- php-fpm
before_script:
- sudo curl -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2
- os: linux
dist: bionic
name: "Zabbix 4.0 @ Ubuntu 18 bionic, PHP 7.0-7.4"
@ -58,7 +82,7 @@ jobs:
addons:
apt:
sources:
- sourceline: 'deb http://repo.zabbix.com/zabbix/4.4/ubuntu bionic main'
- sourceline: 'deb http://repo.zabbix.com/zabbix/4.0/ubuntu bionic main'
key_url: "https://repo.zabbix.com/zabbix-official-repo.key"
- sourceline: 'ppa:ondrej/php'
packages:
@ -109,6 +133,35 @@ jobs:
- php7.4-fpm
before_script:
- sudo curl -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2
- os: linux
dist: bionic
name: "Zabbix 5.0 @ Ubuntu 18 bionic, PHP 7.0-7.4"
arch: amd64
addons:
apt:
sources:
- sourceline: 'deb http://repo.zabbix.com/zabbix/5.0/ubuntu bionic main'
key_url: "https://repo.zabbix.com/zabbix-official-repo.key"
- sourceline: 'ppa:ondrej/php'
packages:
- ca-certificates
- curl
- grep
- sed
- gawk
- lsof
- jq
- libfcgi-bin
- unzip
- zabbix-agent
- zabbix-get
- php7.0-fpm
- php7.1-fpm
- php7.2-fpm
- php7.3-fpm
- php7.4-fpm
before_script:
- sudo curl -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2
script: bash tests/all.sh
notifications:

View File

@ -1,6 +1,6 @@
# PHP-FPM Zabbix Template with Auto Discovery and Multiple Pools
![Zabbix versions](https://img.shields.io/badge/Zabbix_versions-5.0,_4.4,_4.2,_4.0-green.svg?style=flat) ![PHP](https://img.shields.io/badge/PHP-5.3.3+-blue.svg?style=flat) ![PHP7](https://img.shields.io/badge/PHP7-supported-green.svg?style=flat) ![LLD](https://img.shields.io/badge/LLD-yes-green.svg?style=flat) ![ISPConfig](https://img.shields.io/badge/ISPConfig-supported-green.svg?style=flat) [![Build Status](https://travis-ci.com/rvalitov/zabbix-php-fpm.svg?branch=master)](https://travis-ci.com/rvalitov/zabbix-php-fpm)
![Zabbix versions](https://img.shields.io/badge/Zabbix_versions-5.0,_4.4,_4.2,_4.0-green.svg?style=flat) ![PHP](https://img.shields.io/badge/PHP-5.3.3+-blue.svg?style=flat) ![PHP7](https://img.shields.io/badge/PHP7-supported-green.svg?style=flat) ![LLD](https://img.shields.io/badge/LLD-yes-green.svg?style=flat) ![ISPConfig](https://img.shields.io/badge/ISPConfig-supported-green.svg?style=flat) [![Build Status](https://travis-ci.com/rvalitov/zabbix-php-fpm.svg?branch=master)](https://travis-ci.com/rvalitov/zabbix-php-fpm) [![CodeFactor](https://www.codefactor.io/repository/github/rvalitov/zabbix-php-fpm/badge)](https://www.codefactor.io/repository/github/rvalitov/zabbix-php-fpm)
![Banner](https://github.com/rvalitov/zabbix-php-fpm/wiki/media/repository-open-graph-template.png)

View File

@ -59,6 +59,7 @@ getAnyPort() {
}
oneTimeSetUp() {
echo "Started job $TRAVIS_JOB_NAME"
echo "Copying Zabbix files..."
#Install files:
sudo cp "$TRAVIS_BUILD_DIR/zabbix/zabbix_php_fpm_discovery.sh" "/etc/zabbix"
@ -89,6 +90,20 @@ testZabbixGetInstalled() {
assertNotNull "Utility zabbix-get not installed" "$ZABBIX_GET"
}
testZabbixAgentVersion() {
#Example: 4.4
REQUESTED_VERSION=$(echo "$TRAVIS_JOB_NAME" | grep -i -F "zabbix" | head -n1 | cut -d "@" -f1 | cut -d " " -f2)
INSTALLED_VERSION=$(zabbix_agentd -V | grep -F "zabbix" | head -n1 | rev | cut -d " " -f1 | rev | cut -d "." -f1,2)
assertSame "Requested version $REQUESTED_VERSION and installed version $INSTALLED_VERSION of Zabbix agent do not match" "$REQUESTED_VERSION" "$INSTALLED_VERSION"
}
testZabbixGetVersion() {
#Example: 4.4
REQUESTED_VERSION=$(echo "$TRAVIS_JOB_NAME" | grep -i -F "zabbix" | head -n1 | cut -d "@" -f1 | cut -d " " -f2)
INSTALLED_VERSION=$(zabbix_get -V | grep -F "zabbix" | head -n1 | rev | cut -d " " -f1 | rev | cut -d "." -f1,2)
assertSame "Requested version $REQUESTED_VERSION and installed version $INSTALLED_VERSION of zabbix_get do not match" "$REQUESTED_VERSION" "$INSTALLED_VERSION"
}
testPHPIsRunning() {
IS_OK=$(sudo ps ax | grep -F "php-fpm: pool " | grep -F -v "grep" | head -n1)
assertNotNull "No running PHP-FPM instances found" "$IS_OK"