Commit afab9085 by Mario Trangoni

pkg/tsdb/postgres/postgres_test.go: pass context.Background() instead of nil

See,
$ gometalinter --vendor --disable-all --enable=megacheck --disable=gotype --deadline 6m ./...
pkg/tsdb/postgres/postgres_test.go:120:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:200:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:257:34:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:282:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:336:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:363:32:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:453:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:475:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:497:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:519:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:541:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:563:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:585:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:607:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:629:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:652:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:677:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:738:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:761:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:787:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:817:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:847:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:877:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:905:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/postgres/postgres_test.go:933:33:warning: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
parent 3632e9c7
package postgres package postgres
import ( import (
"context"
"fmt" "fmt"
"math/rand" "math/rand"
"strings" "strings"
...@@ -117,7 +118,7 @@ func TestPostgres(t *testing.T) { ...@@ -117,7 +118,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -197,7 +198,7 @@ func TestPostgres(t *testing.T) { ...@@ -197,7 +198,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -254,7 +255,7 @@ func TestPostgres(t *testing.T) { ...@@ -254,7 +255,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -279,7 +280,7 @@ func TestPostgres(t *testing.T) { ...@@ -279,7 +280,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -333,7 +334,7 @@ func TestPostgres(t *testing.T) { ...@@ -333,7 +334,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -360,7 +361,7 @@ func TestPostgres(t *testing.T) { ...@@ -360,7 +361,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -450,7 +451,7 @@ func TestPostgres(t *testing.T) { ...@@ -450,7 +451,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -472,7 +473,7 @@ func TestPostgres(t *testing.T) { ...@@ -472,7 +473,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -494,7 +495,7 @@ func TestPostgres(t *testing.T) { ...@@ -494,7 +495,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -516,7 +517,7 @@ func TestPostgres(t *testing.T) { ...@@ -516,7 +517,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -538,7 +539,7 @@ func TestPostgres(t *testing.T) { ...@@ -538,7 +539,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -560,7 +561,7 @@ func TestPostgres(t *testing.T) { ...@@ -560,7 +561,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -582,7 +583,7 @@ func TestPostgres(t *testing.T) { ...@@ -582,7 +583,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -604,7 +605,7 @@ func TestPostgres(t *testing.T) { ...@@ -604,7 +605,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -626,7 +627,7 @@ func TestPostgres(t *testing.T) { ...@@ -626,7 +627,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -649,7 +650,7 @@ func TestPostgres(t *testing.T) { ...@@ -649,7 +650,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -674,7 +675,7 @@ func TestPostgres(t *testing.T) { ...@@ -674,7 +675,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -735,7 +736,7 @@ func TestPostgres(t *testing.T) { ...@@ -735,7 +736,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
queryResult := resp.Results["Deploys"] queryResult := resp.Results["Deploys"]
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(len(queryResult.Tables[0].Rows), ShouldEqual, 3) So(len(queryResult.Tables[0].Rows), ShouldEqual, 3)
...@@ -758,7 +759,7 @@ func TestPostgres(t *testing.T) { ...@@ -758,7 +759,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
queryResult := resp.Results["Tickets"] queryResult := resp.Results["Tickets"]
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(len(queryResult.Tables[0].Rows), ShouldEqual, 3) So(len(queryResult.Tables[0].Rows), ShouldEqual, 3)
...@@ -784,7 +785,7 @@ func TestPostgres(t *testing.T) { ...@@ -784,7 +785,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -814,7 +815,7 @@ func TestPostgres(t *testing.T) { ...@@ -814,7 +815,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -844,7 +845,7 @@ func TestPostgres(t *testing.T) { ...@@ -844,7 +845,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -874,7 +875,7 @@ func TestPostgres(t *testing.T) { ...@@ -874,7 +875,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -902,7 +903,7 @@ func TestPostgres(t *testing.T) { ...@@ -902,7 +903,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
...@@ -930,7 +931,7 @@ func TestPostgres(t *testing.T) { ...@@ -930,7 +931,7 @@ func TestPostgres(t *testing.T) {
}, },
} }
resp, err := endpoint.Query(nil, nil, query) resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil) So(err, ShouldBeNil)
queryResult := resp.Results["A"] queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil) So(queryResult.Error, ShouldBeNil)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment