Skip to content

Commit 874aea4

Browse files
author
Miguel Martinez
committed
Adding tests and version 3.0.2-2
1 parent 16e9f35 commit 874aea4

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MAINTAINER Bitnami <containers@bitnami.com>
33

44
ENV BITNAMI_APP_NAME=redis \
55
BITNAMI_APP_USER=redis \
6-
BITNAMI_APP_VERSION=3.0.2-1-r01
6+
BITNAMI_APP_VERSION=3.0.2-2
77

88
ENV BITNAMI_APP_DIR=$BITNAMI_PREFIX/$BITNAMI_APP_NAME \
99
BITNAMI_APP_VOL_PREFIX=/bitnami/$BITNAMI_APP_NAME

installer.run.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
285d83fb19c4b8b057e5247d1eafaa55f8ffb88f7666b47531d5f75d8b931420 /tmp/installer.run
1+
40b0d8e66d51ea9a1654be68fedce05ea2e91ce6fd881aff37bc7843995ec75d /tmp/installer.run

test.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bats
2+
3+
CONTAINER_NAME=redis
4+
IMAGE_NAME=bitnami/redis
5+
SLEEP_TIME=3
6+
VOL_PREFIX=/bitnami/$CONTAINER_NAME
7+
HOST_VOL_PREFIX=/tmp/bitnami/$CONTAINER_NAME
8+
REDIS_PASSWORD=test_password123
9+
10+
# Check config override from host
11+
setup() {
12+
mkdir -p $HOST_VOL_PREFIX
13+
}
14+
15+
teardown() {
16+
if [ "$(docker ps -a | grep $CONTAINER_NAME)" ]; then
17+
docker rm -fv $CONTAINER_NAME
18+
fi
19+
}
20+
21+
create_container(){
22+
docker run -itd --name $CONTAINER_NAME $IMAGE_NAME
23+
sleep $SLEEP_TIME
24+
}
25+
26+
27+
@test "Auth if no password provided" {
28+
create_container
29+
run docker exec -it $CONTAINER_NAME redis-cli ping
30+
[[ "$output" =~ "PONG" ]]
31+
}
32+
33+
@test "Auth if password provided" {
34+
docker run -itd --name $CONTAINER_NAME\
35+
-e REDIS_PASSWORD=$REDIS_PASSWORD $IMAGE_NAME
36+
# Longs sleep because of bnconfig password update
37+
sleep 10
38+
# Can't connect without passw
39+
run docker exec -it $CONTAINER_NAME redis-cli ping
40+
[[ "$output" =~ "NOAUTH Authentication required" ]]
41+
run docker exec -it $CONTAINER_NAME redis-cli -a $REDIS_PASSWORD ping
42+
[[ "$output" =~ "PONG" ]]
43+
}
44+
45+
@test "All the volumes exposed" {
46+
create_container
47+
docker inspect $CONTAINER_NAME | {
48+
run grep "\"Volumes\":" -A 3
49+
[[ "$output" =~ "$VOL_PREFIX/logs" ]]
50+
[[ "$output" =~ "$VOL_PREFIX/conf" ]]
51+
[[ "$output" =~ "$VOL_PREFIX/data" ]]
52+
}
53+
}
54+

0 commit comments

Comments
 (0)