forked from gmr/tredis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·40 lines (37 loc) · 960 Bytes
/
run-tests.sh
File metadata and controls
executable file
·40 lines (37 loc) · 960 Bytes
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
#!/bin/bash
get_exposed_port() {
docker-compose port --index=$3 $1 $2 | cut -d: -f2
}
DOCKER_IP=${DOCKER_IP:-$1}
if [ -z "${DOCKER_IP}" ]
then
if test -e /var/run/docker.sock
then
DOCKER_IP=127.0.0.1
else
docker-machine status tredis 2>/dev/null
RESULT=$?
if [ ${RESULT} -ne 0 ]
then
echo "docker-machine is not running, run bootstrap first"
exit 2
fi
eval $(docker-machine env tredis 2>/dev/null) || {
echo "Failed to initialize docker environment"
exit 2
}
DOCKER_IP=$(docker-machine ip tredis)
fi
fi
docker-compose ps 2>/dev/null
RESULT=$?
if [ ${RESULT} -ne 0 ]
then
echo "Docker environment is not running, run bootstrap first"
exit 2
fi
export REDIS_HOST=${DOCKER_IP}
export REDIS_PORT=$(get_exposed_port redis 6379 1)
export REDIS2_PORT=$(get_exposed_port redis 6379 2)
export REDIS2_HOST=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' tredis_redis_2)
nosetests