| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package bigtable | 5 package bigtable |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | |
| 9 "testing" | 8 "testing" |
| 10 | 9 |
| 11 "github.com/luci/luci-go/common/errors" | 10 "github.com/luci/luci-go/common/errors" |
| 11 "github.com/luci/luci-go/common/grpcutil" |
| 12 . "github.com/smartystreets/goconvey/convey" | 12 . "github.com/smartystreets/goconvey/convey" |
| 13 ) | 13 ) |
| 14 | 14 |
| 15 func TestBigTable(t *testing.T) { | 15 func TestBigTable(t *testing.T) { |
| 16 t.Parallel() | 16 t.Parallel() |
| 17 | 17 |
| 18 Convey(`A nil error is not marked transient.`, t, func() { | 18 Convey(`A nil error is not marked transient.`, t, func() { |
| 19 So(wrapTransient(nil), ShouldBeNil) | 19 So(wrapTransient(nil), ShouldBeNil) |
| 20 }) | 20 }) |
| 21 | 21 |
| 22 Convey(`A regular error is not marked transient.`, t, func() { | 22 Convey(`A regular error is not marked transient.`, t, func() { |
| 23 » » So(errors.IsTransient(wrapTransient(fmt.Errorf("boring error")))
, ShouldBeFalse) | 23 » » So(grpcutil.IsTransient(grpcutil.Canceled), ShouldBeFalse) |
| 24 » » So(errors.IsTransient(wrapTransient(grpcutil.Canceled)), ShouldB
eFalse) |
| 24 }) | 25 }) |
| 25 | 26 |
| 26 » Convey(`An error containing "Internal error encountered" is marked trans
ient.`, t, func() { | 27 » Convey(`An gRPC transient error is marked transient.`, t, func() { |
| 27 » » So(errors.IsTransient(wrapTransient(fmt.Errorf("Hey, Internal er
ror encountered!"))), ShouldBeTrue) | 28 » » So(grpcutil.IsTransient(grpcutil.Internal), ShouldBeTrue) |
| 29 » » So(errors.IsTransient(wrapTransient(grpcutil.Internal)), ShouldB
eTrue) |
| 28 }) | 30 }) |
| 29 } | 31 } |
| OLD | NEW |