-
Notifications
You must be signed in to change notification settings - Fork 3
/
travis.bash
67 lines (53 loc) · 1.21 KB
/
travis.bash
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
#!/usr/bin/env bash
# Prepare
wget https://github.com/coreos/etcd/releases/download/v3.0.13/etcd-v3.0.13-linux-amd64.tar.gz
tar zxf etcd-v3.0.13-linux-amd64.tar.gz
mv etcd-v3.0.13-linux-amd64/etcd ./
mv etcd-v3.0.13-linux-amd64/etcdctl ./
go build -v
export ETCDCTL_API=3
function restart(){
PREFIX="$1"
killall -9 etcd
killall -9 etcddir
rm -rf default.etcd
rm -rf sync
mkdir sync
touch sync/.ETCDIR_MARK_FILE_HUGSDBDND
./etcd &
sleep 1
./etcddir "--prefix=$PREFIX" sync &
sleep 1
}
function report(){
echo "REPORT:" "$1"
exit 1
}
restart
echo TEST-3-Simple
./etcdctl put aaa bbb
sleep 1
ps aux | grep etcd
ls -la sync
[ "bbb" == `cat sync/aaa`"" ] || report aaa
restart
echo TEST-3-Pull-3
mkdir test
echo test1 > test/a
echo test2 > test/b
echo test3 > test/c
cp -R test sync/test
sleep 1
echo "ls"
ls sync/test
echo "get all"
./etcdctl get "a" "z"
TEST1=`./etcdctl get test/a | tail -n +2`
echo "TEST1: ${TEST1}"
[ "test1" == "${TEST1}" ] || report test1
TEST2=`./etcdctl get test/b | tail -n +2`
echo "TEST2: ${TEST2}"
[ "test2" == "${TEST2}" ] || report test2
TEST3=`./etcdctl get test/c | tail -n +2`
echo "TEST3: ${TEST3}"
[ "test3" == "${TEST3}" ] || report test3