Skip to content

Commit

Permalink
Merge pull request #348 from lufia/add-docs
Browse files Browse the repository at this point in the history
Add documents for testing
  • Loading branch information
lufia committed Apr 8, 2020
2 parents bc95ce3 + 6f72926 commit de3c02e
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
6 changes: 6 additions & 0 deletions check-disk/UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# How to check the plugin

## Steps

* Run the plugin standalone
* Check the exit code
16 changes: 16 additions & 0 deletions check-disk/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

prog=$(basename $0)
cd $(dirname $0)
plugin=$(basename $(pwd))
if ! which -s $plugin
then
echo "$prog: $plugin is not installed" >&2
exit 2
fi

if $plugin >/dev/null 2>&1; then
echo OK
else
echo FAIL
fi
11 changes: 11 additions & 0 deletions check-ldap/UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# How to check the plugin

## Requirements

* dockerd

## Steps

* Run osixia/docker-openldap
* Run the plugin standalone
* Check the exit code
31 changes: 31 additions & 0 deletions check-ldap/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/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)
plugin=$(basename $(pwd))
if ! which -s $plugin
then
echo "$prog: $plugin is not installed" >&2
exit 2
fi

# By default, LDAP_DOMAIN=example.org and LDAP_ORGANISATION=Example Inc
docker run --name test-$plugin -p 389:389 -d \
-e 'LDAP_ADMIN_PASSWORD=passpass' \
osixia/openldap
trap 'docker stop test-$plugin; docker rm test-$plugin; exit' EXIT
sleep 10

base_dn='dc=example,dc=org'
if $plugin -D "cn=admin,$base_dn" -P passpass -b "$base_dn" -c 2 -w 1
then
echo OK
else
echo FAIL
fi
11 changes: 11 additions & 0 deletions check-redis/UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# How to check the plugin

## Requirements

* dockerd

## Steps

* Run redis:5
* Run the plugin standalone
* Check the exit code
27 changes: 27 additions & 0 deletions check-redis/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/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)
plugin=$(basename $(pwd))
if ! which -s $plugin
then
echo "$prog: $plugin is not installed" >&2
exit 2
fi

docker run --name test-$plugin -p 16379:6379 -d redis:5 --requirepass passpass
trap 'docker stop test-$plugin; docker rm test-$plugin; exit' EXIT
sleep 10

if $plugin reachable --port 16379 --password passpass >/dev/null 2>&1
then
echo OK
else
echo FAIL
fi

0 comments on commit de3c02e

Please sign in to comment.