-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #654 from lufia/add-test-mongodb
[plugin-mongodb] add test.sh
- Loading branch information
Showing
6 changed files
with
55 additions
and
4 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
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
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,11 @@ | ||
# How to check the plugin | ||
|
||
## Requirements | ||
|
||
* dockerd | ||
|
||
## Steps | ||
|
||
* Run mongo:3-xenial | ||
* Run the plugin standalone | ||
* Check the exit code |
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,36 @@ | ||
#!/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 -s $plugin | ||
then | ||
echo "$prog: $plugin is not installed" >&2 | ||
exit 2 | ||
fi | ||
|
||
user=root | ||
password=passpass | ||
port=27017 | ||
docker run -d \ | ||
--name test-$plugin \ | ||
-p $port:$port \ | ||
-e MONGO_INITDB_ROOT_USERNAME=$user \ | ||
-e MONGO_INITDB_ROOT_PASSWORD=$password \ | ||
mongo:3-xenial | ||
trap 'docker stop test-$plugin; docker rm test-$plugin; exit' EXIT | ||
sleep 10 | ||
|
||
if $plugin -port $port -username=$user -password $password | ||
then | ||
echo OK | ||
else | ||
echo FAIL | ||
fi |
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
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