Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: grpc/prpc/client_test.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: more refactor Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package prpc 5 package prpc
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "io/ioutil" 9 "io/ioutil"
10 "net/http" 10 "net/http"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 client.Options.PerRPCTimeout = 10 * time.Second 206 client.Options.PerRPCTimeout = 10 * time.Second
207 client.Options.Retry = func() retry.Iterator { 207 client.Options.Retry = func() retry.Iterator {
208 return &countingRetryIterator{ 208 return &countingRetryIterator{
209 retries: &retries, 209 retries: &retries,
210 } 210 }
211 } 211 }
212 212
213 err := client.Call(ctx, "prpc.Greeter", "SayHell o", req, res) 213 err := client.Call(ctx, "prpc.Greeter", "SayHell o", req, res)
214 » » » » So(err.Error(), ShouldContainSubstring, "failed to send request") 214 » » » » So(err.Error(), ShouldEqual, context.DeadlineExc eeded.Error())
215 So(retries, ShouldEqual, 0) 215 So(retries, ShouldEqual, 0)
216 }) 216 })
217 217
218 Convey(`With a maximum content length smaller than the r esponse, returns "ErrResponseTooBig".`, func(c C) { 218 Convey(`With a maximum content length smaller than the r esponse, returns "ErrResponseTooBig".`, func(c C) {
219 client, server := setUp(sayHello(c)) 219 client, server := setUp(sayHello(c))
220 defer server.Close() 220 defer server.Close()
221 221
222 client.MaxContentLength = 8 222 client.MaxContentLength = 8
223 err := client.Call(ctx, "prpc.Greeter", "SayHell o", req, res) 223 err := client.Call(ctx, "prpc.Greeter", "SayHell o", req, res)
224 So(err, ShouldEqual, ErrResponseTooBig) 224 So(err, ShouldEqual, ErrResponseTooBig)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 retries *int 333 retries *int
334 } 334 }
335 335
336 func (it *countingRetryIterator) Next(c context.Context, err error) time.Duratio n { 336 func (it *countingRetryIterator) Next(c context.Context, err error) time.Duratio n {
337 *(it.retries)-- 337 *(it.retries)--
338 if *it.retries <= 0 { 338 if *it.retries <= 0 {
339 return retry.Stop 339 return retry.Stop
340 } 340 }
341 return 0 341 return 0
342 } 342 }
OLDNEW
« grpc/grpcutil/errors.go ('K') | « grpc/prpc/client.go ('k') | grpc/prpc/encoding.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698