Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update .circleci script with go1.11.1 and better coverage #813

Merged
merged 9 commits into from
Oct 17, 2018
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 @@ -39,15 +39,32 @@ jobs:
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 PATH=$GOPATH/bin:$PATH
for pkg in $(go list ./... | grep -v vendor); do
mstoykov marked this conversation as resolved.
Show resolved Hide resolved
go test -race -timeout 600s $pkg
done

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 @@ -1151,7 +1151,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
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