Skip to content

Commit

Permalink
Improve redis-basics-persistent by actually checking
Browse files Browse the repository at this point in the history
On SIGTERM a dump.rdb should be created when no special
parameters are passed.

see redis/docker-library-redis#4
  • Loading branch information
TimWolla committed Sep 1, 2016
1 parent aa766b9 commit 476e371
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
1 change: 0 additions & 1 deletion test/tests/redis-basics-persistent/real-run.sh

This file was deleted.

31 changes: 25 additions & 6 deletions test/tests/redis-basics-persistent/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,29 @@ dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"

image="$1"

newImage="$("$dir/../image-name.sh" librarytest/redis-basics-persistent "$image")"
"$dir/../docker-build.sh" "$dir" "$newImage" <<EOD
FROM $image
CMD ["--appendonly", "yes"]
EOD
cname="redis-container-$RANDOM-$RANDOM"
cid="$(docker run -d --name "$cname" "$image")"
trap "docker rm -vf $cid > /dev/null" EXIT

exec "$dir/real-run.sh" "$newImage"
redis-cli() {
docker run --rm -i \
--link "$cname":redis \
--entrypoint redis-cli \
"$image" \
-h redis \
"$@"
}

# http://redis.io/topics/quickstart#check-if-redis-is-working

. "$dir/../../retry.sh" --tries 20 '[ "$(redis-cli ping)" = "PONG" ]'

[ "$(redis-cli set mykey somevalue)" = 'OK' ]
[ "$(redis-cli get mykey)" = 'somevalue' ]

docker stop "$cname"
docker start "$cname"

. "$dir/../../retry.sh" --tries 20 '[ "$(redis-cli ping)" = "PONG" ]'

[ "$(redis-cli get mykey)" = 'somevalue' ]

0 comments on commit 476e371

Please sign in to comment.