diff --git a/.circleci/config.yml b/.circleci/config.yml index 8d6da8f1496..c8b24f78280 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: lint: docker: - - image: circleci/golang:1.10 + - image: circleci/golang:1.11.1 environment: GOPATH: /home/circleci/.go_workspace working_directory: /home/circleci/.go_workspace/src/github.com/loadimpact/k6 @@ -27,7 +27,7 @@ jobs: test: docker: - - image: circleci/golang:1.10 + - image: circleci/golang:1.11.1 environment: GOPATH: /home/circleci/.go_workspace working_directory: /home/circleci/.go_workspace/src/github.com/loadimpact/k6 @@ -36,18 +36,35 @@ jobs: - run: name: Run tests and code coverage command: | + export GOMAXPROCS=4 export PATH=$GOPATH/bin:$PATH echo "mode: set" > coverage.txt for pkg in $(go list ./... | grep -v vendor); do - go test -race -timeout 600s -coverprofile=$(echo $pkg | tr / -).coverage $pkg + go test -race -timeout 600s --coverpkg="$(go list ./... | tr '\n' ',')" -coverprofile=$(echo $pkg | tr / -).coverage $pkg done grep -h -v "^mode:" *.coverage >> coverage.txt rm -f *.coverage bash <(curl -s https://codecov.io/bash) + + test-go110: + docker: + - image: circleci/golang:1.10.3 + environment: + GOPATH: /home/circleci/.go_workspace + working_directory: /home/circleci/.go_workspace/src/github.com/loadimpact/k6 + steps: + - checkout + - run: + name: Run tests and code coverage + command: | + export GOMAXPROCS=4 + export PATH=$GOPATH/bin:$PATH + go test -race -timeout 600s ./... + build-docker-images: docker: - - image: circleci/golang:1.10 + - image: circleci/golang:1.11.1 environment: GOPATH: /home/circleci/.go_workspace working_directory: /home/circleci/.go_workspace/src/github.com/loadimpact/k6 @@ -92,7 +109,7 @@ jobs: build-linux-packages: docker: - - image: circleci/golang:1.10 + - image: circleci/golang:1.11.1 environment: GOPATH: /home/circleci/.go_workspace working_directory: /home/circleci/.go_workspace/src/github.com/loadimpact/k6 @@ -145,6 +162,10 @@ workflows: filters: tags: only: /.*/ + - test-go110: + filters: + tags: + only: /.*/ - build-docker-images: requires: - lint @@ -157,4 +178,4 @@ workflows: branches: ignore: /.*/ tags: - only: /^v.*/ \ No newline at end of file + only: /^v.*/ diff --git a/api/v1/metric_test.go b/api/v1/metric_test.go index 76ce883aff0..18fbfdeebc7 100644 --- a/api/v1/metric_test.go +++ b/api/v1/metric_test.go @@ -31,7 +31,7 @@ import ( func TestNullMetricTypeJSON(t *testing.T) { values := map[NullMetricType]string{ - {}: `null`, + {}: `null`, {stats.Counter, true}: `"counter"`, {stats.Gauge, true}: `"gauge"`, {stats.Trend, true}: `"trend"`, @@ -59,7 +59,7 @@ func TestNullMetricTypeJSON(t *testing.T) { func TestNullValueTypeJSON(t *testing.T) { values := map[NullValueType]string{ - {}: `null`, + {}: `null`, {stats.Default, true}: `"default"`, {stats.Time, true}: `"time"`, } diff --git a/core/engine_test.go b/core/engine_test.go index 4ec9edf9453..5f6088ce7d8 100644 --- a/core/engine_test.go +++ b/core/engine_test.go @@ -563,10 +563,10 @@ func TestSentReceivedMetrics(t *testing.T) { require.NoError(t, err) options := lib.Options{ - Iterations: null.IntFrom(tc.Iterations), - VUs: null.IntFrom(tc.VUs), - VUsMax: null.IntFrom(tc.VUs), - Hosts: tb.Dialer.Hosts, + Iterations: null.IntFrom(tc.Iterations), + VUs: null.IntFrom(tc.VUs), + VUsMax: null.IntFrom(tc.VUs), + Hosts: tb.Dialer.Hosts, InsecureSkipTLSVerify: null.BoolFrom(true), NoVUConnectionReuse: null.BoolFrom(noConnReuse), } diff --git a/js/runner_test.go b/js/runner_test.go index ec2951098e5..7a43f929457 100644 --- a/js/runner_test.go +++ b/js/runner_test.go @@ -1155,7 +1155,7 @@ func TestVUIntegrationClientCerts(t *testing.T) { return } r1.SetOptions(lib.Options{ - Throw: null.BoolFrom(true), + Throw: null.BoolFrom(true), InsecureSkipTLSVerify: null.BoolFrom(true), }) diff --git a/lib/archive_test.go b/lib/archive_test.go index c8d505ec2df..21005a6e35f 100644 --- a/lib/archive_test.go +++ b/lib/archive_test.go @@ -31,12 +31,12 @@ import ( func TestNormalizeAndAnonymizePath(t *testing.T) { testdata := map[string]string{ - "/tmp": "/tmp", - "/tmp/myfile.txt": "/tmp/myfile.txt", - "/home/myname": "/home/nobody", - "/home/myname/foo/bar/myfile.txt": "/home/nobody/foo/bar/myfile.txt", - "/Users/myname/myfile.txt": "/Users/nobody/myfile.txt", - "/Documents and Settings/myname/myfile.txt": "/Documents and Settings/nobody/myfile.txt", + "/tmp": "/tmp", + "/tmp/myfile.txt": "/tmp/myfile.txt", + "/home/myname": "/home/nobody", + "/home/myname/foo/bar/myfile.txt": "/home/nobody/foo/bar/myfile.txt", + "/Users/myname/myfile.txt": "/Users/nobody/myfile.txt", + "/Documents and Settings/myname/myfile.txt": "/Documents and Settings/nobody/myfile.txt", "//etc/hosts": "/etc/hosts", "\\\\MYSHARED\\dir\\dir\\myfile.txt": "/nobody/dir/dir/myfile.txt", "C:\\Users\\myname\\dir\\myfile.txt": "/C/Users/nobody/dir/myfile.txt", diff --git a/release notes/upcoming.md b/release notes/upcoming.md index 152f1560c08..3356cb56aac 100644 --- a/release notes/upcoming.md +++ b/release notes/upcoming.md @@ -102,6 +102,9 @@ A new option that disables the end-of-test summary has been added. That summary * Cloud output: improved outlier metric detection for small batches (#744) * Use 20 as the the default values of the `batch` and `batchPerHost` options. They determine the maximum number of parallel requests (in total and per-host respectively) an `http.batch()` call will make per VU. The previous value for `batch` was 10 and for `batchPerHost` it was 0 (unlimited). We now also use their values to determine the maximum number of open idle connections in a VU (#685) * Due to refactoring needed for the redirect fixes, the NTLM authentication library k6 uses is changed from [this](https://github.com/ThomsonReutersEikon/go-ntlm/) to [this](https://github.com/Azure/go-ntlmssp) (#753) +* Switched the default CircleCI tests and linting to use Go 1.11.1, but we still maintain 1.10 + compatibility by running all of the tests with Go 1.10.3 too. Official k6 standalone builds will + also be done with Go 1.11+ from now on (#813) ## Bugs fixed! diff --git a/stats/influxdb/config_test.go b/stats/influxdb/config_test.go index d3db7021c92..115831eedf2 100644 --- a/stats/influxdb/config_test.go +++ b/stats/influxdb/config_test.go @@ -29,10 +29,10 @@ import ( func TestParseArg(t *testing.T) { testdata := map[string]Config{ - "": {}, - "db=dbname": {DB: null.StringFrom("dbname")}, - "addr=http://localhost:8086": {Addr: null.StringFrom("http://localhost:8086")}, - "addr=http://localhost:8086,db=dbname": {Addr: null.StringFrom("http://localhost:8086"), DB: null.StringFrom("dbname")}, + "": {}, + "db=dbname": {DB: null.StringFrom("dbname")}, + "addr=http://localhost:8086": {Addr: null.StringFrom("http://localhost:8086")}, + "addr=http://localhost:8086,db=dbname": {Addr: null.StringFrom("http://localhost:8086"), DB: null.StringFrom("dbname")}, "addr=http://localhost:8086,db=dbname,insecure=false,payloadSize=69,": {Addr: null.StringFrom("http://localhost:8086"), DB: null.StringFrom("dbname"), Insecure: null.BoolFrom(false), PayloadSize: null.IntFrom(69)}, "addr=http://localhost:8086,db=dbname,insecure=false,payloadSize=69,tagsAsFields={fake}": {Addr: null.StringFrom("http://localhost:8086"), DB: null.StringFrom("dbname"), Insecure: null.BoolFrom(false), PayloadSize: null.IntFrom(69), TagsAsFields: []string{"fake"}}, }