| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
function printHelp() { |
| 4 |
>&2 echo "USAGE: $0 -i PATH_TO_SOURCE_TARBALL -o OUTDIR |
| 5 |
|
| 6 |
Runs unit tests for influxdb. |
| 7 |
|
| 8 |
If the environment variable GO_NEXT is not empty, tests run with the 'next' version of Go. |
| 9 |
" |
| 10 |
} |
| 11 |
|
| 12 |
if [ $# -eq 0 ]; then |
| 13 |
printHelp |
| 14 |
exit 1 |
| 15 |
fi |
| 16 |
|
| 17 |
SRCDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 18 |
source "$SRCDIR/../_go_versions.sh" |
| 19 |
|
| 20 |
OUTDIR="" |
| 21 |
TARBALL="" |
| 22 |
|
| 23 |
while getopts hi:o: arg; do |
| 24 |
case "$arg" in |
| 25 |
h) printHelp; exit 1;; |
| 26 |
i) TARBALL="$OPTARG";; |
| 27 |
o) OUTDIR="$OPTARG";; |
| 28 |
esac |
| 29 |
done |
| 30 |
|
| 31 |
if [ -z "$TARBALL" ] || [ -z "$OUTDIR" ]; then |
| 32 |
printHelp |
| 33 |
exit 1 |
| 34 |
fi |
| 35 |
|
| 36 |
if [ -z "$GO_NEXT" ]; then |
| 37 |
DOCKER_TAG=latest |
| 38 |
GO_VERSION="$GO_CURRENT_VERSION" |
| 39 |
else |
| 40 |
DOCKER_TAG=next |
| 41 |
GO_VERSION="$GO_NEXT_VERSION" |
| 42 |
fi |
| 43 |
docker build --build-arg "GO_VERSION=$GO_VERSION" -t influxdata/influxdb/releng/unit-tests:"$DOCKER_TAG" "$SRCDIR" |
| 44 |
|
| 45 |
docker run --rm \ |
| 46 |
--mount type=bind,source="$OUTDIR",destination=/out \ |
| 47 |
--mount type=bind,source="$TARBALL",destination=/influxdb-src.tar.gz,ro=1 \ |
| 48 |
influxdata/influxdb/releng/unit-tests:"$DOCKER_TAG" |