-
Notifications
You must be signed in to change notification settings - Fork 150
/
test.sh
executable file
·39 lines (34 loc) · 987 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
prog=$(basename $0)
if ! [ -S /var/run/docker.sock ]
then
echo "$prog: there are no running docker" >&2
exit 2
fi
cd $(dirname $0)
PATH=$(pwd):$PATH
plugin=$(basename $(pwd))
if ! which $plugin >/dev/null
then
echo "$prog: $plugin is not installed" >&2
exit 2
fi
password=passpass
port=9200
docker run -d \
--name test-$plugin \
-p $port:$port \
-e "ELASTIC_PASSWORD=$password" \
-e "discovery.type=single-node" \
-e "ingest.geoip.downloader.enabled=false" \
elasticsearch:8.5.0
trap 'docker stop test-$plugin; docker rm test-$plugin; exit' EXIT
sleep 40
# to store previous value to calculate a diff of metrics
$plugin -scheme https -port $port -user=elastic -password $password -insecure -suppress-missing-error >/dev/null 2>&1
sleep 1
$plugin -scheme https -port $port -user=elastic -password $password -insecure -suppress-missing-error | graphite-metric-test -f rule.txt
status=$?
docker stop "test-$plugin"
docker rm "test-$plugin"
exit $status