test: simplify

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-04-12 11:08:01 -07:00
parent 095fc0b411
commit 3c4ace2d27

26
test
View File

@ -137,7 +137,7 @@ function unit_pass {
else
USERTIMEOUT="${TIMEOUT}"
fi
go test ${GO_TEST_FLAG} -timeout "${USERTIMEOUT}" "${COVER}" ${RACE} -cpu 1,2,4 ${RUN_ARG} "$@" "${TEST[@]}"
go test ${GO_TEST_FLAG} -timeout "${USERTIMEOUT}" "${COVER}" ${RACE} -cpu 4 ${RUN_ARG} "$@" "${TEST[@]}"
}
function integration_pass {
@ -157,33 +157,29 @@ function integration_pass {
# if TESTCASE not set, PKG set, run all test cases in specified package
# if TESTCASE not set, PKG not set, run all tests in all integration and integration_extra packages
if [ -z "${TESTCASE}" ] && [ -z "${USERPKG}" ]; then
go test -timeout "${USERTIMEOUT}" -v -cpu 1,2,4 "$@" "${REPO_PATH}/integration"
go test -timeout "${USERTIMEOUT}" -v -cpu 4 "$@" "${REPO_PATH}/integration"
integration_extra "$@"
else
if [ -z "${USERPKG}" ]; then
INTEGTESTPKG=("${REPO_PATH}/integration"
"${REPO_PATH}/client/integration"
"${REPO_PATH}/clientv3/integration"
"${REPO_PATH}/contrib/raftexample"
"${REPO_PATH}/store")
else
INTEGTESTPKG=("${TEST[@]}")
fi
go test -timeout "${USERTIMEOUT}" -v -cpu 1,2,4 "${RUN_ARG}" "$@" "${INTEGTESTPKG[@]}"
go test -timeout "${USERTIMEOUT}" -v -cpu 4 "${RUN_ARG}" "$@" "${INTEGTESTPKG[@]}"
fi
}
function integration_extra {
go test -timeout 1m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/client/integration"
go test -timeout 25m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/clientv3/integration"
go test -timeout 1m -v -cpu 1,2,4 "$@" "${REPO_PATH}/contrib/raftexample"
go test -timeout 5m -v ${RACE} -tags v2v3 "$@" "${REPO_PATH}/etcdserver/v2store"
go test -timeout 1m -v ${RACE} -cpu 1,2,4 -run=Example "$@" "${TEST[@]}"
go test -timeout 1m -v ${RACE} -cpu 4 "$@" "${REPO_PATH}/client/integration"
go test -timeout 25m -v ${RACE} -cpu 4 "$@" "${REPO_PATH}/clientv3/integration"
}
function functional_pass {
# Clean up any data and logs from previous runs
rm -rf /tmp/etcd-agent-data-*
rm -rf /tmp/etcd-functional-* /tmp/etcd-functional-*.backup
for a in 1 2 3; do
./bin/etcd-agent --network tcp --address 127.0.0.1:${a}9027 &
@ -299,15 +295,15 @@ function e2e_pass {
USERTIMEOUT="${TIMEOUT}"
fi
go test -timeout "${USERTIMEOUT}" -v -cpu 1,2,4 "${RUN_ARG}" "$@" "${REPO_PATH}/e2e"
go test -timeout "${USERTIMEOUT}" -v -cpu 4 "${RUN_ARG}" "$@" "${REPO_PATH}/e2e"
}
function integration_e2e_pass {
echo "Running integration and e2e tests..."
go test -timeout 20m -v -cpu 1,2,4 "$@" "${REPO_PATH}/e2e" &
go test -timeout 20m -v -cpu 4 "$@" "${REPO_PATH}/e2e" &
e2epid="$!"
go test -timeout 20m -v -cpu 1,2,4 "$@" "${REPO_PATH}/integration" &
go test -timeout 20m -v -cpu 4 "$@" "${REPO_PATH}/integration" &
intpid="$!"
wait $e2epid
wait $intpid
@ -315,8 +311,8 @@ function integration_e2e_pass {
}
function grpcproxy_pass {
go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 1,2,4 "$@" "${REPO_PATH}/integration"
go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 1,2,4 "$@" "${REPO_PATH}/clientv3/integration"
go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 4 "$@" "${REPO_PATH}/integration"
go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 4 "$@" "${REPO_PATH}/clientv3/integration"
go test -timeout 20m -v -tags cluster_proxy "$@" "${REPO_PATH}/e2e"
}