From 321ae4ff04d44fbe47974e8ff5dedad1aa5e79b7 Mon Sep 17 00:00:00 2001 From: Jacob Marble Date: Mon, 16 Apr 2018 12:00:44 -0700 Subject: [PATCH] update CircleCI config to 2.0 syntax (#9711) * enable flaky test, see if CircleCI fails * Use CircleCI 2.0 with docker layer caching * update CONTRIBUTING --- .circleci/config.yml | 19 ++++++++++++++ .gitignore | 1 + CONTRIBUTING.md | 4 ++- circle-test.sh | 39 ----------------------------- circle.yml | 23 ----------------- services/subscriber/service_test.go | 1 - 6 files changed, 23 insertions(+), 64 deletions(-) create mode 100644 .circleci/config.yml delete mode 100755 circle-test.sh delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..bc285c7a73 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,19 @@ +version: 2 + +jobs: + build: + machine: + enabled: true + docker_layer_caching: true + environment: + - PARALLELISM: 4 # Input to influxdb/build.py + parallelism: 5 # How many CircleCI test containers + steps: + - checkout + - run: + name: Ensure CircleCI parallelism matches "./test.sh count" + command: "[ `./test.sh count` -eq $CIRCLE_NODE_TOTAL ]" + - run: + name: Execute test + command: ./test.sh $CIRCLE_NODE_INDEX + no_output_timeout: 1500s diff --git a/.gitignore b/.gitignore index ab15c1fddc..b30f31b05f 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ config.toml # test data files integration/migration_data/ +test-logs/ # man outputs man/*.xml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75ddb7ecf4..b9e9cdc5b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -277,4 +277,6 @@ func BenchmarkSomething(b *testing.B) { Continuous Integration testing ----- -InfluxDB uses CircleCI for continuous integration testing. To see how the code is built and tested, check out [this file](https://github.com/influxdata/influxdb/blob/master/circle-test.sh). It closely follows the build and test process outlined above. You can see the exact version of Go InfluxDB uses for testing by consulting that file. +InfluxDB uses CircleCI for continuous integration testing. CircleCI executes [test.sh](https://github.com/influxdata/influxdb/blob/master/test.sh), so you may do the same on your local development environment before creating a pull request. + +The `test.sh` script executes a test suite with 5 variants (standard 64 bit, 64 bit with race detection, 32 bit, TSI, go version 1.9.2), each executes with a different arg, 0 through 4. Unless you know differently, `./test.sh 0` is probably all you need. diff --git a/circle-test.sh b/circle-test.sh deleted file mode 100755 index 105b44185c..0000000000 --- a/circle-test.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# 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" -# Don't delete the container since CircleCI doesn't have permission to do so. -export DOCKER_RM="false" - -# 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 - fi -done - -# 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 diff --git a/circle.yml b/circle.yml deleted file mode 100644 index cff2bdfc5e..0000000000 --- a/circle.yml +++ /dev/null @@ -1,23 +0,0 @@ -machine: - services: - - docker - environment: - GODIST: "go1.9.2.linux-amd64.tar.gz" - post: - - mkdir -p download - - test -e download/$GODIST || curl -o download/$GODIST https://storage.googleapis.com/golang/$GODIST - - sudo rm -rf /usr/local/go - - sudo tar -C /usr/local -xzf download/$GODIST - -dependencies: - cache_directories: - - ~/download - override: - - ./test.sh count - -test: - override: - - bash circle-test.sh: - parallel: true - # Race tests using 960s timeout - timeout: 1500 diff --git a/services/subscriber/service_test.go b/services/subscriber/service_test.go index 789875789a..aa0d564467 100644 --- a/services/subscriber/service_test.go +++ b/services/subscriber/service_test.go @@ -185,7 +185,6 @@ func TestService_ModeALL(t *testing.T) { } func TestService_ModeANY(t *testing.T) { - t.Skip("TODO: flaky test.") dataChanged := make(chan struct{}) ms := MetaClient{} ms.WaitForDataChangedFn = func() chan struct{} {