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

Side by Side Diff: filters/featureBreaker/featurebreaker_test.go

Issue 1247283003: Improve docs (Closed) Base URL: https://github.com/luci/gae.git@reduce_size
Patch Set: fix comments Created 5 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
« no previous file with comments | « filters/featureBreaker/featurebreaker.go ('k') | filters/featureBreaker/gi.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package featureBreaker
6
7 import (
8 "errors"
9 "testing"
10
11 "golang.org/x/net/context"
12
13 "github.com/luci/gae/impl/memory"
14 "github.com/luci/gae/service/rawdatastore"
15
16 . "github.com/smartystreets/goconvey/convey"
17 )
18
19 func TestBrokenFeatures(t *testing.T) {
20 t.Parallel()
21
22 e := errors.New("default err")
23
24 Convey("BrokenFeatures", t, func() {
25 c := memory.Use(context.Background())
26
27 Convey("Can break rds", func() {
28 Convey("without a default", func() {
29 c, bf := FilterRDS(c, nil)
30 rds := rawdatastore.Get(c)
31
32 Convey("by specifying an error", func() {
33 bf.BreakFeatures(e, "Get", "Put")
34 So(rds.Get(nil, nil), ShouldEqual, e)
35
36 Convey("and you can unbreak them as well ", func() {
37 bf.UnbreakFeatures("Get")
38 So(rds.Get(nil, nil), ShouldEqua l, rawdatastore.ErrInvalidKey)
39
40 Convey("no broken features at al l is a shortcut", func() {
41 bf.UnbreakFeatures("Put" )
42 So(rds.Get(nil, nil), Sh ouldEqual, rawdatastore.ErrInvalidKey)
43 })
44 })
45 })
46
47 Convey("Not specifying an error gets you a gener ic error", func() {
48 bf.BreakFeatures(nil, "Get")
49 So(rds.Get(nil, nil).Error(), ShouldEqua l, `feature "Get" is broken`)
50 })
51 })
52
53 Convey("with a default", func() {
54 c, bf := FilterRDS(c, e)
55 rds := rawdatastore.Get(c)
56 bf.BreakFeatures(nil, "Get")
57 So(rds.Get(nil, nil), ShouldEqual, e)
58 })
59 })
60 })
61 }
OLDNEW
« no previous file with comments | « filters/featureBreaker/featurebreaker.go ('k') | filters/featureBreaker/gi.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698