-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
138 lines (122 loc) · 3.24 KB
/
Makefile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
PATH := ./redis-git/src:${PATH}
# CLUSTER REDIS NODES
define NODE1_CONF
daemonize yes
port 30001
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node1.pid
logfile /tmp/redis_cluster_node1.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node1.conf
endef
define NODE2_CONF
daemonize yes
port 30002
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node2.pid
logfile /tmp/redis_cluster_node2.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node2.conf
endef
define NODE3_CONF
daemonize yes
port 30003
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node3.pid
logfile /tmp/redis_cluster_node3.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node3.conf
endef
define NODE4_CONF
daemonize yes
port 30004
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node4.pid
logfile /tmp/redis_cluster_node4.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node4.conf
endef
define NODE5_CONF
daemonize yes
port 30005
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node5.pid
logfile /tmp/redis_cluster_node5.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node5.conf
endef
define NODE6_CONF
daemonize yes
port 30006
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node6.pid
logfile /tmp/redis_cluster_node6.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node6.conf
endef
export NODE1_CONF
export NODE2_CONF
export NODE3_CONF
export NODE4_CONF
export NODE5_CONF
export NODE6_CONF
help:
@echo "Please use 'make <target>' where <target> is one of"
@echo " start starts a test redis cluster"
@echo " cleanup cleanup config files after redis cluster"
@echo " stop stops all redis servers"
@echo " travis-run starts the redis cluster and runs your tests"
@echo " travis-install install redis from 'unstable' branch"
start: cleanup
echo "$$NODE1_CONF" | redis-server -
echo "$$NODE2_CONF" | redis-server -
echo "$$NODE3_CONF" | redis-server -
echo "$$NODE4_CONF" | redis-server -
echo "$$NODE5_CONF" | redis-server -
echo "$$NODE6_CONF" | redis-server -
cleanup:
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
- rm -f /tmp/redis_cluster_node1.conf
- rm dump.rdb appendonly.aof - 2>/dev/null
stop:
kill `cat /tmp/redis_cluster_node1.pid` || true
kill `cat /tmp/redis_cluster_node2.pid` || true
kill `cat /tmp/redis_cluster_node3.pid` || true
kill `cat /tmp/redis_cluster_node4.pid` || true
kill `cat /tmp/redis_cluster_node5.pid` || true
kill `cat /tmp/redis_cluster_node6.pid` || true
make cleanup
travis-run:
# Start all cluster nodes
make start
sleep 5
# Join all nodes in the cluster
echo "yes" | ruby redis-git/src/redis-trib.rb create --replicas 1 127.0.0.1:30001 127.0.0.1:30002 127.0.0.1:30003 127.0.0.1:30004 127.0.0.1:30005 127.0.0.1:30006
sleep 5
#########
# Run your tests/code here
# For example: py.test
#########
npm install
npm run prepublish
npm run test
npm run coveralls
# Kill all redis nodes and do cleanup
make stop
travis-install:
[ ! -e redis-git ] && git clone https://github.com/antirez/redis.git redis-git || true
make -C redis-git -j4
gem install redis
sleep 3