diff --git a/.circleci/config.yml b/.circleci/config.yml index db2bfc3492..adf05f186c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/Makefile b/Makefile index 51b1314c19..9377f76b14 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/etc/test-flux.sh b/etc/test-flux.sh new file mode 100755 index 0000000000..80a529dcb4 --- /dev/null +++ b/etc/test-flux.sh @@ -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