vendor: update all dependencies to latest versions

This commit is contained in:
Nick Craig-Wood
2018-01-16 13:20:59 +00:00
parent 8e83fb6fb9
commit 7d3a17725d
4878 changed files with 1974213 additions and 201199 deletions
+27 -2
View File
@@ -16,12 +16,14 @@ package internal
import (
"errors"
"fmt"
"testing"
"time"
"golang.org/x/net/context"
gax "github.com/googleapis/gax-go"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func TestRetry(t *testing.T) {
@@ -62,3 +64,26 @@ func TestRetry(t *testing.T) {
t.Error("got nil, want error")
}
}
func TestRetryPreserveError(t *testing.T) {
// Retry tries to preserve the type and other information from
// the last error returned by the function.
err := retry(context.Background(), gax.Backoff{},
func() (bool, error) {
return false, status.Error(codes.NotFound, "not found")
},
func(context.Context, time.Duration) error {
return context.DeadlineExceeded
})
got, ok := status.FromError(err)
if !ok {
t.Fatalf("got %T, wanted a status", got)
}
if g, w := got.Code(), codes.NotFound; g != w {
t.Errorf("got code %v, want %v", g, w)
}
wantMessage := fmt.Sprintf("retry failed with %v; last error: not found", context.DeadlineExceeded)
if g, w := got.Message(), wantMessage; g != w {
t.Errorf("got message %q, want %q", g, w)
}
}