2015-04-16 03:44:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2015-12-03 16:44:17 +00:00
|
|
|
# This is the InfluxDB test script for CircleCI, it is a light wrapper around ./test.sh.
|
|
|
|
|
|
|
|
# Exit if any command fails
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Get dir of script and make it is our working directory.
|
|
|
|
DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
|
|
|
cd $DIR
|
|
|
|
|
|
|
|
export OUTPUT_DIR="$CIRCLE_ARTIFACTS"
|
2016-02-02 20:46:13 +00:00
|
|
|
# Don't delete the container since CircleCI doesn't have permission to do so.
|
|
|
|
export DOCKER_RM="false"
|
2015-12-03 16:44:17 +00:00
|
|
|
|
|
|
|
# Get number of test environments.
|
|
|
|
count=$(./test.sh count)
|
|
|
|
# Check that we aren't wasting CircleCI nodes.
|
|
|
|
if [ $CIRCLE_NODE_TOTAL -gt $count ]
|
|
|
|
then
|
|
|
|
echo "More CircleCI nodes allocated than tests environments to run!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Map CircleCI nodes to test environments.
|
|
|
|
tests=$(seq 0 $((count - 1)))
|
|
|
|
for i in $tests
|
|
|
|
do
|
|
|
|
mine=$(( $i % $CIRCLE_NODE_TOTAL ))
|
|
|
|
if [ $mine -eq $CIRCLE_NODE_INDEX ]
|
|
|
|
then
|
|
|
|
echo "Running test env index: $i"
|
|
|
|
./test.sh $i
|
2015-04-16 03:44:14 +00:00
|
|
|
fi
|
2015-12-03 16:44:17 +00:00
|
|
|
done
|
2017-04-10 15:25:19 +00:00
|
|
|
|
|
|
|
# Copy the JUnit test XML to the test reports folder.
|
|
|
|
mkdir -p $CIRCLE_TEST_REPORTS/reports
|
|
|
|
cp test-results.xml $CIRCLE_TEST_REPORTS/reports/test-results.xml
|