-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (65 loc) · 1.87 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
# redis cluster nodes
define REDIS_CLUSTER_NODE_CONF_A
daemonize yes
port 7100
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node_a.pid
logfile /tmp/redis_cluster_node_a.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node_a.conf
endef
define REDIS_CLUSTER_NODE_CONF_B
daemonize yes
port 7101
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node_b.pid
logfile /tmp/redis_cluster_node_b.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node_b.conf
endef
define REDIS_CLUSTER_NODE_CONF_C
daemonize yes
port 7102
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node_c.pid
logfile /tmp/redis_cluster_node_c.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node_c.conf
endef
ifndef REDIS_SERVER
REDIS_SERVER=redis-server
endif
export REDIS_CLUSTER_NODE_CONF_A
export REDIS_CLUSTER_NODE_CONF_B
export REDIS_CLUSTER_NODE_CONF_C
help:
@echo "Use 'make <target>', where <target> is one of"
@echo " clean remove temporary files"
@echo " test run test suite"
clean:
-find . -type f -name "*.pyc" -exec rm -f "{}" \;
start-test:clean-test
sleep 1
echo "$$REDIS_CLUSTER_NODE_CONF_A" | $(REDIS_SERVER) -
echo "$$REDIS_CLUSTER_NODE_CONF_B" | $(REDIS_SERVER) -
echo "$$REDIS_CLUSTER_NODE_CONF_C" | $(REDIS_SERVER) -
sleep 5
clean-test:stop-test
rm -f /tmp/redis_cluster_node*.conf
rm -f dump.rdb appendonly.aof
stop-test:
test -e /tmp/redis_cluster_node_a.pid && kill `cat /tmp/redis_cluster_node_a.pid` || true
test -e /tmp/redis_cluster_node_b.pid && kill `cat /tmp/redis_cluster_node_b.pid` || true
test -e /tmp/redis_cluster_node_c.pid && kill `cat /tmp/redis_cluster_node_c.pid` || true
rm -f /tmp/redis_cluster_node_*.conf
test:start-test
python -m unittest discover -s test/ -p "*.py"
make stop-test
@echo "================="
@echo "| Test done \o/ |"