Skip to content

Commit

Permalink
Update .circleci script with go1.11.1 and better coverage (grafana#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov authored Oct 17, 2018
1 parent 8573795 commit 5788bee
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 23 deletions.
33 changes: 27 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -145,6 +162,10 @@ workflows:
filters:
tags:
only: /.*/
- test-go110:
filters:
tags:
only: /.*/
- build-docker-images:
requires:
- lint
Expand All @@ -157,4 +178,4 @@ workflows:
branches:
ignore: /.*/
tags:
only: /^v.*/
only: /^v.*/
4 changes: 2 additions & 2 deletions api/v1/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`,
Expand Down Expand Up @@ -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"`,
}
Expand Down
8 changes: 4 additions & 4 deletions core/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
2 changes: 1 addition & 1 deletion js/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ func TestVUIntegrationClientCerts(t *testing.T) {
return
}
r1.SetOptions(lib.Options{
Throw: null.BoolFrom(true),
Throw: null.BoolFrom(true),
InsecureSkipTLSVerify: null.BoolFrom(true),
})

Expand Down
12 changes: 6 additions & 6 deletions lib/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions release notes/upcoming.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
8 changes: 4 additions & 4 deletions stats/influxdb/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
}
Expand Down

0 comments on commit 5788bee

Please sign in to comment.