aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Ingo Gottwald <in.gottwald@gmail.com> 2019-10-01 22:32:59 +0200
committerGravatar Miek Gieben <miek@miek.nl> 2019-10-01 21:32:59 +0100
commitfa6718d02606852897c6c91cacf0f80c4d1a0243 (patch)
tree0cae9a891a98cac7f175c1a46338e88ce5377949 /test
parent575cea4496fd8556ec198ea43c99a5c6cfc603b2 (diff)
downloadcoredns-fa6718d02606852897c6c91cacf0f80c4d1a0243.tar.gz
coredns-fa6718d02606852897c6c91cacf0f80c4d1a0243.tar.zst
coredns-fa6718d02606852897c6c91cacf0f80c4d1a0243.zip
Fix grpc test vet warning (#3341)
This fixes the vet warning: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak. Signed-off-by: Ingo Gottwald <in.gottwald@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/grpc_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/grpc_test.go b/test/grpc_test.go
index a0d48490d..bb49e6b9b 100644
--- a/test/grpc_test.go
+++ b/test/grpc_test.go
@@ -22,7 +22,8 @@ func TestGrpc(t *testing.T) {
}
defer g.Stop()
- ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
conn, err := grpc.DialContext(ctx, tcp, grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
t.Fatalf("Expected no error but got: %s", err)