split up unit-tests and use 4 containers (they're free)

This commit is contained in:
Michael Hobbs
2015-04-24 13:52:14 -07:00
parent 3c056527e8
commit 0d838d1248
3 changed files with 49 additions and 3 deletions

37
tests/ci/unit_test_runner.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
is_number() {
local NUMBER=$1; local NUM_RE='^[0-9]+$'
if [[ $NUMBER =~ $NUM_RE ]];then
return 0
else
return 1
fi
}
usage() {
echo "usage: $0 1|2"
exit 0
}
BATCH_NUM="$1"
is_number $BATCH_NUM || usage
TESTS=( $(find $(dirname $0)/../unit -maxdepth 1 -name "*.bats") )
HALF_TESTS=$(( ${#TESTS[@]} / 2 ))
FIRST_HALF=${TESTS[@]:0:${HALF_TESTS}}
LAST_HALF=${TESTS[@]:${HALF_TESTS}:${#TESTS[@]}}
case "$BATCH_NUM" in
1)
bats $FIRST_HALF
;;
2)
bats $LAST_HALF
;;
*)
usage
;;
esac