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

Side by Side Diff: common/errors/transient_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
(Empty)
1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package errors
6
7 import (
8 "errors"
9 "testing"
10
11 . "github.com/smartystreets/goconvey/convey"
12 )
13
14 func TestTransientError(t *testing.T) {
15 t.Parallel()
16
17 Convey(`A nil error`, t, func() {
18 err := error(nil)
19
20 Convey(`Is not transient.`, func() {
21 So(IsTransient(err), ShouldBeFalse)
22 })
23
24 Convey(`Returns nil when wrapped with a transient error.`, func( ) {
25 So(WrapTransient(err), ShouldBeNil)
26 })
27 })
28
29 Convey(`An error`, t, func() {
30 err := errors.New("test error")
31
32 Convey(`Is not transient.`, func() {
33 So(IsTransient(err), ShouldBeFalse)
34 })
35 Convey(`When wrapped with a transient error`, func() {
36 terr := WrapTransient(err)
37 Convey(`Has the same error string.`, func() {
38 So(terr.Error(), ShouldEqual, "test error")
39 })
40 Convey(`Is transient.`, func() {
41 So(IsTransient(terr), ShouldBeTrue)
42 })
43 })
44
45 Convey(`A MultiError with a transient sub-error is transient.`, func() {
46 So(IsTransient(MultiError{nil, WrapTransient(err), err}) , ShouldBeTrue)
47 })
48 })
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698