forked from dainis/terraform-provider-zabbix
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run tests in Github Actions against Zabbix 3.0, 3.2, 3.4, 4.0, 4.2, 4…
….4, 5.0, 5.2, 5.4, 6.0 and 6.2
- Loading branch information
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go 1.18 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
|
||
- name: Tests | ||
run: | | ||
make test | ||
testacc: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
zabbix_version: ["3.0", "3.2", "3.4", "4.0", "4.2", "4.4", "5.0", "5.2", "5.4", "6.0", "6.2"] | ||
|
||
services: | ||
mysql-server: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: true | ||
ports: | ||
- 3306:3306 | ||
# needed because the mysql container does not provide a healthcheck | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 | ||
|
||
zabbix-server: | ||
image: zabbix/zabbix-server-mysql:alpine-${{ matrix.zabbix_version }}-latest | ||
env: | ||
DB_SERVER_HOST: mysql-server | ||
DB_SERVER_PORT: 3306 | ||
MYSQL_ALLOW_EMPTY_PASSWORD: true | ||
MYSQL_USER: zabbix | ||
ports: | ||
- 10051:10051 | ||
|
||
zabbix-web-nginx-mysql: | ||
image: zabbix/zabbix-web-nginx-mysql:alpine-${{ matrix.zabbix_version }}-latest | ||
env: | ||
ZBX_SERVER_HOST: zabbix-server | ||
ZBX_SERVER_PORT: 10051 | ||
DB_SERVER_HOST: mysql-server | ||
DB_SERVER_PORT: 3306 | ||
MYSQL_ALLOW_EMPTY_PASSWORD: true | ||
MYSQL_USER: zabbix | ||
ports: | ||
- 8080:${{ contains(fromJson('["3.2", "3.4", "4.2"]'), matrix.zabbix_version) && '80' || '8080' }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go 1.18 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
|
||
- name: Acceptance Tests | ||
env: | ||
ZABBIX_SERVER_URL: http://localhost:8080/api_jsonrpc.php | ||
ZABBIX_USER: Admin | ||
ZABBIX_PASSWORD: zabbix | ||
run: | | ||
while true ; do | ||
output=$(curl -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"user.login","params":{"user":"'$ZABBIX_USER'","password":"'$ZABBIX_PASSWORD'"},"id":1,"auth":null}' $ZABBIX_SERVER_URL || echo error) | ||
echo $output | ||
echo $output | grep -v error > /dev/null && break | ||
echo "Waiting 5s for Zabbix Server to be ready..." | ||
sleep 5 | ||
done | ||
make testacc |