feat(ci): run flux integration tests as its own job (#20901)

pull/20908/head
Jonathan A. Sternberg 2021-03-09 12:24:28 -06:00 committed by GitHub
parent 7169df3b51
commit a27b67bdda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 0 deletions

View File

@ -12,6 +12,9 @@ workflows:
- jstest:
requires:
- jsdeps
- fluxtest:
requires:
- godeps
- influxql_validation:
requires:
- godeps
@ -77,6 +80,9 @@ workflows:
- jslint:
requires:
- jsdeps
- fluxtest:
requires:
- godeps
- deploy_nightly:
requires:
- gotest
@ -457,6 +463,21 @@ jobs:
- store_test_results:
path: /tmp/test-results
fluxtest:
docker:
- image: cimg/go:1.15.6
environment:
GOCACHE: /tmp/go-cache
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
steps:
- checkout
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- install_core_deps
- run: make test-flux
influxql_validation:
docker:
- image: cimg/go:1.15.6

View File

@ -151,6 +151,9 @@ test-js: node_modules
test-go:
$(GO_TEST) $(GO_TEST_PATHS)
test-flux:
@./etc/test-flux.sh
test-influxql-integration:
$(GO_TEST) -mod=readonly ./influxql/_v1tests

49
etc/test-flux.sh Executable file
View File

@ -0,0 +1,49 @@
#!/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() {
log "Running integration tests..."
./fluxtest -v -p flux.zip
}
cleanup() {
rm -f flux.zip fluxtest
}
main() {
build_test_harness
download_flux_archive
run_integration_tests
cleanup
}
main