File tree Expand file tree Collapse file tree 7 files changed +106
-3
lines changed Expand file tree Collapse file tree 7 files changed +106
-3
lines changed Original file line number Diff line number Diff line change 1+ language : go
2+ sudo : true
3+
4+ go :
5+ - 1.15.x
6+ - 1.14.x
7+ - master
8+
9+ env :
10+ - GO111MODULE=on GOPROXY=https://goproxy.io,direct
11+
12+ services :
13+ - rabbitmq
14+ - elasticsearch
15+
16+ before_install :
17+
18+ addons :
19+ apt :
20+ update : true
21+
22+ install :
23+
24+
25+ before_script :
26+ - rabbitmqctl add_user test test
27+ - rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
28+ # # 编译
29+ - cd distributed && bash script/build.sh
30+ # ES 启动速度比较慢
31+ - sleep 10
32+ # # 运行多个实例
33+ - bash script/start_min.sh
34+
35+ script :
36+ # 测试部分
37+ - bash script/test.sh
38+
39+ after_script :
40+ - bash script/stop_min.sh
41+ - cd ..
42+
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ import (
1313)
1414
1515/**
16- 如果是相对位置,则是相对执行文件的位置
16+ 1. 如果是相对位置,则是相对执行文件的位置
17+ 2. 如果环境变量中指定了变量,那么环境变量优先
1718 */
1819var ConfigFile string
1920
Original file line number Diff line number Diff line change 1+ 0 . 本脚本在distributed目录下运行。切记!
2+ 1 . build.s 是构建脚本
3+ 2 . start_min.sh 是在单机测试时最小运行
4+ 3 . stop_min.sh 是关闭所有测试
5+ 3 . test.sh 用于运行单元测试内容
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # 本脚本在项目根目录下执行
3+ # 本脚本在项目distributed目录下执行
44# 需要go环境, go版本在go.mod中定义
55
66go build -o ./build/interserver ./interface/main.go
1111 mkdir ./build/config
1212fi
1313cp ./config/data.yml ./build/config/
14- cp ./config/interface.yml ./build/config/
14+ cp ./config/interface.yml ./build/config/
15+
16+ if ! [ -d ./build/var ]
17+ then
18+ mkdir ./build/var
19+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ cd build
4+
5+ LISTEN_ADDRESS=:23335 STORAGE_ROOT=./data1 nohup ./dataserver > dataserver1.out 2>&1 & echo $! > ./var/datarun1.pid
6+ LISTEN_ADDRESS=:23336 STORAGE_ROOT=./data2 nohup ./dataserver > dataserver2.out 2>&1 & echo $! > ./var/datarun2.pid
7+ LISTEN_ADDRESS=:23337 STORAGE_ROOT=./data3 nohup ./dataserver > dataserver3.out 2>&1 & echo $! > ./var/datarun3.pid
8+ LISTEN_ADDRESS=:23338 STORAGE_ROOT=./data4 nohup ./dataserver > dataserver4.out 2>&1 & echo $! > ./var/datarun4.pid
9+ LISTEN_ADDRESS=:23339 STORAGE_ROOT=./data5 nohup ./dataserver > dataserver5.out 2>&1 & echo $! > ./var/datarun5.pid
10+ LISTEN_ADDRESS=:23340 STORAGE_ROOT=./data6 nohup ./dataserver > dataserver6.out 2>&1 & echo $! > ./var/datarun6.pid
11+
12+ nohup ./interserver > interserver.out 2>&1 & echo $! > ./var/interfacerun.pid
13+
14+ ps -aux | grep dataserver
15+ ps -aux | grep interserver
16+
17+ cd ..
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ cd build
4+
5+ echo ' before stop'
6+ ps -aux | grep dataserver
7+ ps -aux | grep interserver
8+
9+ kill ` cat var/datarun1.pid`
10+ kill ` cat var/datarun2.pid`
11+ kill ` cat var/datarun3.pid`
12+ kill ` cat var/datarun4.pid`
13+ kill ` cat var/datarun5.pid`
14+ kill ` cat var/datarun6.pid`
15+
16+ kill ` cat var/interfacerun.pid`
17+
18+ echo ' after stop'
19+ ps -aux | grep dataserver
20+ ps -aux | grep interserver
21+
22+ cd ..
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ go test -v -run TestPut ./test/
4+ go test -v -run TestGet ./test/
5+ go test -v -run TestGetAllVersion ./test/
6+ go test -v -run TestLocat ./test/
7+ go test -v -run Test_putBigFile ./test/
8+ go test -v -run Test_getBigFile ./test/
9+ go test -v -run TestDel ./test/
10+
11+
You can’t perform that action at this time.
0 commit comments