-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·57 lines (50 loc) · 986 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
prog=$(basename "$0")
if ! docker info >/dev/null
then
echo "$prog: there are no running docker" >&2
exit 2
fi
cd "$(dirname "$0")" || exit
PATH=$(pwd):$PATH
plugin=$(basename "$(pwd)")
if ! which "$plugin" >/dev/null
then
echo "$prog: $plugin is not installed" >&2
exit 2
fi
user=root
password=passpass
port=27017
status=0
for v in 6.0 5.0 4.4 4.2 4.0 3.6
do
docker run -d \
--name "test-$plugin" \
-p $port:$port \
-e MONGO_INITDB_ROOT_USERNAME=$user \
-e MONGO_INITDB_ROOT_PASSWORD=$password \
mongo:$v
trap 'docker stop test-$plugin; docker rm test-$plugin; exit 1' 1 2 3 15
sleep 10
# url style
if $plugin -url mongodb://$user:$password@localhost:$port
then
echo OK: $v
else
status=$?
echo NG: $v
fi
sleep 5
# args style
if $plugin -port $port -username=$user -password $password
then
echo OK: $v
else
status=$?
echo NG: $v
fi
docker stop "test-$plugin"
docker rm "test-$plugin"
done
exit "$status"