-
Notifications
You must be signed in to change notification settings - Fork 18
/
test.sh
executable file
·92 lines (70 loc) · 3.29 KB
/
test.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
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
#!/usr/bin/env bash
# TODO: retire this script with go tests
set -e
go build -o tmp/harp
server1=harp_test_server1
server2=harp_test_server2
dmip=`docker-machine ip default`
[ `docker ps -a | grep -o $server1` ] && {
docker rm -f $server1
}
[ `docker ps -a | grep -o $server2` ] && {
docker rm -f $server2
}
docker run -P -p 49153:22 -d -v ~/.ssh/id_rsa.pub:/home/app/.ssh/authorized_keys --name $server1 sshd
docker run -P -p 49154:22 -d -v ~/.ssh/id_rsa.pub:/home/app/.ssh/authorized_keys --name $server2 sshd
# trap 'cat tmp/test.log' ERR
# rm -f tmp/test.log
# create a big file
dd if=/dev/zero of=test/files/big-file bs=$((3<<20)) count=1
touch test/files/test.swp
echo ====================
echo tmp/harp -c test/harp.json -s prod deploy
test/update_pkg.sh
tmp/harp -c test/harp.json -s prod deploy
echo ====================
echo tmp/harp -c test/harp2.json -s prod deploy
test/update_pkg.sh
tmp/harp -c test/harp2.json -s prod deploy
ssh app@$dmip -p 49153 -- cat test.log
echo ====================
echo tmp/harp -c test/harp3.json -s prod deploy
test/update_pkg.sh
tmp/harp -c test/harp3.json -s prod deploy
ssh app@$dmip -p 49153 -- cat harp/app/log/app.log
echo tmp/harp -c test/harp.json -build-args "-tags argtag" -server app@$dmip:49153 deploy
tmp/harp -c test/harp.json -build-args "-tags argtag" -server app@$dmip:49153 deploy
echo ====================
echo tmp/harp -c test/harp.json -server app@$dmip:49153 deploy
tmp/harp -c test/harp.json -server app@$dmip:49153 deploy
echo ====================
echo tmp/harp -c test/harp.json -server app@$dmip:49153 run "AppEnv=prod test/migration.go -arg1 val1 -arg2 val2" test/migration2.go
tmp/harp -c test/harp.json -server app@$dmip:49153 run "AppEnv=prod test/migration.go -arg1 val1 -arg2 val2" test/migration2.go
echo ====================
echo tmp/harp -c test/harp.json -s prod run github.com/bom-d-van/harp/test/migration3
tmp/harp -c test/harp.json -s prod run github.com/bom-d-van/harp/test/migration3
echo ====================
echo tmp/harp -c test/harp2.json -s prod run github.com/bom-d-van/harp/test/migration3
tmp/harp -c test/harp2.json -s prod run github.com/bom-d-van/harp/test/migration3
ssh app@$dmip -p 49153 -- tail migration.log
ssh app@$dmip -p 49153 -- tail /home/app/src/github.com/bom-d-van/harp/test/migration.log
echo ====================
echo tmp/harp -c test/harp.json -s prod rollback ls
for version in `tmp/harp -c test/harp.json -s prod rollback ls | tail -2`; do
echo "tmp/harp -c test/harp.json -s prod rollback $version"
tmp/harp -c test/harp.json -s prod rollback $version
ssh app@$dmip -p 49153 -- tail /home/app/harp/app/log/app.log
# ssh app@$dmip -p 49153 -- cat /home/app/src/github.com/bom-d-van/harp/test/files/file1
# ssh app@$dmip -p 49153 -- cat /home/app/src/github.com/bom-d-van/harp/test/files/file2
done
echo ====================
echo tmp/harp -server app@$dmip:49153 -t run github.com/bom-d-van/harp/test/migration3
tmp/harp -server app@$dmip:49153 -t run github.com/bom-d-van/harp/test/migration3
git checkout -- test/test_version.go test/files/file1 test/files/file2
echo ====================
echo "tmp/harp -server app@$dmip:49153 console <<<ls"
tmp/harp -c test/harp.json -server app@$dmip:49153 console <<<ls
tmp/harp -c test/harp.json -s prod console <<<ls
# remove big file
rm test/files/big-file
rm test/files/test.swp