| 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 "testing" | 8 "testing" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| 11 "github.com/luci/luci-go/common/errors" | 11 "github.com/luci/luci-go/common/errors" |
| 12 "github.com/luci/luci-go/common/grpcutil" | |
| 13 "github.com/luci/luci-go/server/logdog/storage" | 12 "github.com/luci/luci-go/server/logdog/storage" |
| 14 "golang.org/x/net/context" | 13 "golang.org/x/net/context" |
| 15 "google.golang.org/cloud/bigtable" | 14 "google.golang.org/cloud/bigtable" |
| 16 | 15 |
| 17 . "github.com/smartystreets/goconvey/convey" | 16 . "github.com/smartystreets/goconvey/convey" |
| 18 ) | 17 ) |
| 19 | 18 |
| 20 func TestBigTable(t *testing.T) { | 19 func TestBigTable(t *testing.T) { |
| 21 t.Parallel() | 20 t.Parallel() |
| 22 | 21 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 }) | 77 }) |
| 79 | 78 |
| 80 Convey(`With return an error if the configuration fails
to apply.`, func() { | 79 Convey(`With return an error if the configuration fails
to apply.`, func() { |
| 81 bt.err = errors.New("test error") | 80 bt.err = errors.New("test error") |
| 82 | 81 |
| 83 So(s.Config(cfg), ShouldEqual, bt.err) | 82 So(s.Config(cfg), ShouldEqual, bt.err) |
| 84 }) | 83 }) |
| 85 }) | 84 }) |
| 86 }) | 85 }) |
| 87 } | 86 } |
| 88 | |
| 89 func TestBigTableErrors(t *testing.T) { | |
| 90 t.Parallel() | |
| 91 | |
| 92 Convey(`A nil error is not marked transient.`, t, func() { | |
| 93 So(wrapTransient(nil), ShouldBeNil) | |
| 94 }) | |
| 95 | |
| 96 Convey(`A regular error is not marked transient.`, t, func() { | |
| 97 So(grpcutil.IsTransient(grpcutil.Canceled), ShouldBeFalse) | |
| 98 So(errors.IsTransient(wrapTransient(grpcutil.Canceled)), ShouldB
eFalse) | |
| 99 }) | |
| 100 | |
| 101 Convey(`An gRPC transient error is marked transient.`, t, func() { | |
| 102 So(grpcutil.IsTransient(grpcutil.Internal), ShouldBeTrue) | |
| 103 So(errors.IsTransient(wrapTransient(grpcutil.Internal)), ShouldB
eTrue) | |
| 104 }) | |
| 105 } | |
| OLD | NEW |