2021-03-30 15:18:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
readonly GO=${GO:-go}
|
|
|
|
|
|
|
|
log() {
|
|
|
|
local now
|
|
|
|
now=$(date '+%Y/%m/%d %H:%M:%S')
|
|
|
|
echo "[${now}]" "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
determine_flux_revision() {
|
|
|
|
local version revision
|
|
|
|
version=$("$GO" list -m -f '{{.Version}}' github.com/influxdata/flux)
|
|
|
|
revision=$(printf "%s" "${version}" | cut -d- -f 3)
|
|
|
|
if [[ ${revision} != "" ]]; then
|
|
|
|
printf "%s\n" "${revision}"
|
|
|
|
else
|
|
|
|
printf "%s\n" "${version}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
download_flux_archive() {
|
|
|
|
local revision
|
|
|
|
revision=$(determine_flux_revision)
|
|
|
|
log "Downloading flux archive (${revision})..."
|
|
|
|
curl -sLo flux.zip "https://github.com/influxdata/flux/archive/${revision}.zip"
|
|
|
|
}
|
|
|
|
|
|
|
|
build_test_harness() {
|
|
|
|
log "Building test harness..."
|
|
|
|
"$GO" build -o fluxtest ./internal/cmd/fluxtest-harness-influxdb
|
|
|
|
}
|
|
|
|
|
|
|
|
run_integration_tests() {
|
2021-04-23 13:52:20 +00:00
|
|
|
log "Running integration tests..."
|
|
|
|
./fluxtest -v -p flux.zip -p flux/stdlib
|
2021-03-30 15:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
rm -f flux.zip fluxtest
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
build_test_harness
|
|
|
|
download_flux_archive
|
|
|
|
run_integration_tests
|
|
|
|
cleanup
|
|
|
|
}
|
|
|
|
main
|