now that go test runs iteration loops, use that instead of custom executor

pull/6/head
Mike Danese 2016-05-31 17:29:57 -07:00
parent 38d5be4f36
commit d046275a36
1 changed files with 3 additions and 51 deletions

View File

@ -74,7 +74,6 @@ usage: $0 [OPTIONS] [TARGETS]
OPTIONS:
-p <number> : number of parallel workers, must be >= 1
-i <number> : number of times to run each test per worker, must be >= 1
EOF
}
@ -82,7 +81,6 @@ isnum() {
[[ "$1" =~ ^[0-9]+$ ]]
}
iterations=1
parallel=1
while getopts "hp:i:" opt ; do
case $opt in
@ -99,12 +97,9 @@ while getopts "hp:i:" opt ; do
fi
;;
i)
iterations="$OPTARG"
if ! isnum "${iterations}" || [[ "${iterations}" -le 0 ]]; then
kube::log::usage "'$0': argument to -i must be numeric and greater than 0"
kube::test::usage
exit 1
fi
kube::log::usage "'$0': use GOFLAGS='-count <num-iterations>'"
kube::test::usage
exit 1
;;
?)
kube::test::usage
@ -180,50 +175,7 @@ produceJUnitXMLReport() {
kube::log::status "Saved JUnit XML test report to ${junit_xml_filename}"
}
runTestIterations() {
local worker=$1
shift
kube::log::status "Worker ${worker}: Running ${iterations} times"
for arg; do
trap 'exit 1' SIGINT
local pkg=${KUBE_GO_PACKAGE}/${arg}
kube::log::status "${pkg}"
# keep going, even if there are failures
local pass=0
local count=0
for i in $(seq 1 ${iterations}); do
if go test "${goflags[@]:+${goflags[@]}}" \
${KUBE_RACE} ${KUBE_TIMEOUT} "${pkg}" \
"${testargs[@]:+${testargs[@]}}"; then
pass=$((pass + 1))
else
ITERATION_FAILURES=$((ITERATION_FAILURES + 1))
fi
count=$((count + 1))
done 2>&1
kube::log::status "Worker ${worker}: ${pass} / ${count} passed"
done
return 0
}
runTests() {
# TODO: this should probably be refactored to avoid code duplication with the
# coverage version.
if [[ $iterations -gt 1 ]]; then
ITERATION_FAILURES=0 # purposely non-local
if [[ $# -eq 0 ]]; then
set -- $(kube::test::find_dirs)
fi
for p in $(seq 1 ${parallel}); do
runTestIterations ${p} "$@" &
done
wait
if [[ ${ITERATION_FAILURES} -gt 0 ]]; then
return 1
fi
return 0
fi
local junit_filename_prefix
junit_filename_prefix=$(junitFilenamePrefix)