2016-09-29 22:46:05 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2016-09-29 23:07:07 +00:00
|
|
|
# Find all packages containing Go source code inside the current directory
|
2016-09-29 22:46:05 +00:00
|
|
|
packages=$(find ./ -maxdepth 2 -name '*.go' -printf '%h\n' | sort | uniq)
|
|
|
|
|
2016-11-11 20:42:35 +00:00
|
|
|
# The consul package only supports Go1.7+ and therefore we will only run the
|
2016-09-29 22:46:05 +00:00
|
|
|
# corresponding tests on these versions.
|
|
|
|
goversion=$(go version)
|
2016-12-20 16:25:24 +00:00
|
|
|
if [[ "$goversion" == *"go1.5"* ]] ||
|
2016-11-11 20:42:35 +00:00
|
|
|
[[ "$goversion" == *"go1.6"* ]]; then
|
2016-09-29 22:46:05 +00:00
|
|
|
|
2016-09-29 23:07:07 +00:00
|
|
|
echo "Skipping tests requiring Consul which is not supported on $goversion"
|
2016-09-29 22:46:05 +00:00
|
|
|
|
2016-09-29 23:07:07 +00:00
|
|
|
# Exclude consullocker since this may not be run on all Go versions.
|
|
|
|
packages=$(echo "$packages" | sed '/consul/d')
|
2016-09-29 22:46:05 +00:00
|
|
|
else
|
2016-09-29 23:07:07 +00:00
|
|
|
# Install the Consul packages which are not vendored.
|
|
|
|
go get -u github.com/hashicorp/consul/...
|
2016-09-29 22:46:05 +00:00
|
|
|
fi
|
2016-09-29 23:07:07 +00:00
|
|
|
|
|
|
|
# Install the AWS SDK which is explicitly not vendored
|
|
|
|
go get -u github.com/aws/aws-sdk-go/...
|
|
|
|
|
|
|
|
# Test all packages which are allowed on all Go versions
|
2016-10-13 14:45:19 +00:00
|
|
|
go test $packages
|