Skip to content

Commit 839429f

Browse files
author
Alexander Popov
committed
test: add skripts for test
1 parent 1fe6e96 commit 839429f

File tree

4 files changed

+47
-6
lines changed

4 files changed

+47
-6
lines changed

Makefile.tests

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,7 @@ clean_zabbix:
134134
docker rm `docker ps -a -q --filter="name=zabbix-web-apache-pgsql" ` | true
135135
docker stop pg_for_zabbix | true
136136
docker rm pg_for_zabbix | true
137-
docker network rm network-local-tests | true
137+
docker network rm network-local-tests | true
138+
139+
installcheck:
140+
$(WORKDIR)/tests/tests.sh

tests/tests.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash -ex
2+
3+
pwd
4+
cd tests
5+
###### test mamonsu report *
6+
./tests/report.sh
7+
8+
###### test mamonsu agent *
9+
# ./tests/agent.sh !!! todo
10+
11+
###### test mamonsu bootstrap *
12+
#./tests/bootstrap.sh
13+
#
14+
#
15+
####### test mamonsu zabbix *
16+
#mkdir -p /etc/mamonsu/ !!! todo
17+
#sudo cp ../packaging/conf/example.conf /etc/mamonsu/agent.conf
18+
##ZABBIX_DOCKER_VERSIONS="5.2 5.0 4.4 4.2 4.0 3.4 3.2 3.0"
19+
#ZABBIX_DOCKER_VERSIONS="5.2 5.0 4.4 4.2 4.0 3.2 3.0"
20+
#for VER in $ZABBIX_DOCKER_VERSIONS
21+
#do
22+
# IFS='.' read -ra VER_ARRAY <<<$VER
23+
# VER_MAJOR=${VER_ARRAY[0]}
24+
# VER_MINOR=${VER_ARRAY[1]}
25+
#
26+
# Z_PORT=":80$VER_MAJOR$VER_MINOR"
27+
#
28+
# export Z_URL="http://192.168.26.228:$Z_PORT"
29+
# export Z_USER=Admin
30+
# export Z_PASSWORD=zabbix
31+
# export Z_VERSION=$VER
32+
# echo " Z_URL=$Z_URL,
33+
# Z_USER=$Z_USER
34+
# Z_PASSWORD=$Z_PASSWORD
35+
# Z_VERSION=$Z_VERSION"
36+
# ./tests/zabbix.sh
37+
#done
38+
39+
exit 0

tests/tests/agent.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
mkdir -p /etc/mamonsu
1010

11-
cat <<EOF > /etc/mamonsu/agent.conf
11+
cat <<EOF > sudo /etc/mamonsu/agent.conf
1212
[postgres]
1313
host = 127.0.0.1
1414
user = mamonsu_agent
@@ -18,7 +18,6 @@ password = supersecret
1818
[zabbix]
1919
enabled = False
2020
21-
2221
[agent]
2322
enabled = True
2423
host = 127.0.0.1
@@ -45,5 +44,5 @@ mamonsu agent metric-list
4544
mamonsu agent -c /etc/mamonsu/agent.conf version
4645
mamonsu agent metric-get system.disk.all_read[] -c /etc/mamonsu/agent.conf
4746
mamonsu agent -c /etc/mamonsu/agent.conf metric-list
48-
47+
kill `jobs -p`
4948
exit 0

tests/tests/bootstrap.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export PSQL="psql -U $PGSUPERUSER"
1515
WHOAMI=`whoami`
1616
if [[ "$WHOAMI" != "postgres" ]]
1717
then
18-
$PSQL -U postgres -c "create user $WHOAMI superuser"
19-
$PSQL -U postgres -c "create database $WHOAMI owner $WHOAMI"
18+
$PSQL -U postgres -c "create user $WHOAMI superuser" | true
19+
$PSQL -U postgres -c "create database $WHOAMI owner $WHOAMI" | true
2020
export PGSUPERUSER=$WHOAMI
2121
export PSQL="psql -U $PGSUPERUSER"
2222
fi

0 commit comments

Comments
 (0)