forked from andyqzb/twemproxy
-
Notifications
You must be signed in to change notification settings - Fork 7
/
travis.sh
executable file
·59 lines (48 loc) · 1.3 KB
/
travis.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# Main ci script for nutcracker tests
set -xeu
function print_usage() {
echo "Usage: $0 [REDIS_VER]" 1>&2
echo "e.g. $0 3.2.12" 1>&2
exit 1
}
REDIS_VER=3.2.11
if [[ "$#" > 1 ]]; then
echo "Too many arguments" 1>&2
print_usage
elif [[ "$#" > 0 ]]; then
REDIS_VER="$1"
fi
PACKAGE_NAME="nutcrackerci"
TAG=$( git describe --always )
DOCKER_IMG_NAME=twemproxy-build-$PACKAGE_NAME-$REDIS_VER-$TAG
rm -rf twemproxy
DOCKER_TAG=twemproxy-$PACKAGE_NAME-$REDIS_VER:$TAG
docker build -f ci/Dockerfile \
--tag $DOCKER_TAG \
--build-arg=REDIS_VER=$REDIS_VER \
.
# Run c unit tests
UNIT_TEST_FAIL=no
if ! docker run \
--rm \
-e REDIS_VER=$REDIS_VER \
--workdir=/usr/src/twemproxy/src \
--name=$DOCKER_IMG_NAME \
--entrypoint=/bin/sh \
$DOCKER_TAG \
-c 'make test_all && ./test_all'; then
UNIT_TEST_FAIL=yes
fi
# Run nose tests
# NOTE: It was never possible to reload nutcracker configs (in any nutcracker version so far) with SIGUSR1 so test_system.test_reload has always been skipped.
docker run \
--rm \
-e REDIS_VER=$REDIS_VER \
--name=$DOCKER_IMG_NAME \
$DOCKER_TAG \
nosetests -v test_redis test_memcache test_system.test_sentinel
if [ $UNIT_TEST_FAIL = yes ]; then
echo "See earlier output, unit tests failed" 1>&2
exit 1
fi