forked from RBMHTechnology/eventuate-chaos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple-partitions.sh
executable file
·52 lines (36 loc) · 1.15 KB
/
simple-partitions.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
#!/bin/bash -eu
CASSANDRAS="c1 c2 c3"
SETTLE_DELAY=${SETTLE_DELAY:-40}
function settle() {
echo "waiting $SETTLE_DELAY seconds for cluster to settle..."
sleep $SETTLE_DELAY
}
function wait_till_healthy() {
echo "waiting till cluster is up and running..."
while ! ./interact.py >/dev/null 2>&1; do
sleep 2
done
}
wait_till_healthy
echo "*** checking working persistence with 1 node partition each"
for cassandra in $CASSANDRAS; do
echo "partition of cassandra '$cassandra'"
sudo blockade partition $cassandra
settle
echo "checking persistence..."
./interact.py >/dev/null
done
echo "*** checking non-working persistence with 2 node partitions"
for cassandra in $CASSANDRAS; do
echo "partition of chaos application + '$cassandra'"
sudo blockade partition location-1,$cassandra
settle
echo "checking persistence..."
./interact.py >/dev/null 2>&1 && (echo "persistence working when it shouldn't" && exit 1)
# reconnect cluster for next partition
sudo blockade join
wait_till_healthy
done
echo "*** checking final reconnect"
./interact.py >/dev/null
echo "test successfully finished"