| 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 // +build appengine | 5 // +build appengine |
| 6 | 6 |
| 7 package prod | 7 package prod |
| 8 | 8 |
| 9 import ( | 9 import ( |
| 10 "testing" | 10 "testing" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 defer inst.Close() | 49 defer inst.Close() |
| 50 | 50 |
| 51 req, err := inst.NewRequest("GET", "/", nil) | 51 req, err := inst.NewRequest("GET", "/", nil) |
| 52 So(err, ShouldBeNil) | 52 So(err, ShouldBeNil) |
| 53 | 53 |
| 54 ctx := Use(context.Background(), req) | 54 ctx := Use(context.Background(), req) |
| 55 ds := datastore.Get(ctx) | 55 ds := datastore.Get(ctx) |
| 56 mc := memcache.Get(ctx) | 56 mc := memcache.Get(ctx) |
| 57 inf := info.Get(ctx) | 57 inf := info.Get(ctx) |
| 58 | 58 |
| 59 » » // You have to visually confirm that this actually happens in th
e stdout | 59 » » Convey("logging allows you to tweak the level", func() { |
| 60 » » // of the test... yeah I know. | 60 » » » // You have to visually confirm that this actually happe
ns in the stdout |
| 61 » » logging.Infof(ctx, "I am a banana") | 61 » » » // of the test... yeah I know. |
| 62 » » » logging.Debugf(ctx, "SHOULD NOT SEE") |
| 63 » » » logging.Infof(ctx, "SHOULD SEE") |
| 64 |
| 65 » » » ctx = logging.SetLevel(ctx, logging.Debug) |
| 66 » » » logging.Debugf(ctx, "SHOULD SEE") |
| 67 » » » logging.Infof(ctx, "SHOULD SEE (2)") |
| 68 » » }) |
| 62 | 69 |
| 63 Convey("Can probe/change Namespace", func() { | 70 Convey("Can probe/change Namespace", func() { |
| 64 So(inf.GetNamespace(), ShouldEqual, "") | 71 So(inf.GetNamespace(), ShouldEqual, "") |
| 65 ctx, err = inf.Namespace("wat") | 72 ctx, err = inf.Namespace("wat") |
| 66 So(err, ShouldBeNil) | 73 So(err, ShouldBeNil) |
| 67 inf = info.Get(ctx) | 74 inf = info.Get(ctx) |
| 68 So(inf.GetNamespace(), ShouldEqual, "wat") | 75 So(inf.GetNamespace(), ShouldEqual, "wat") |
| 69 ds = datastore.Get(ctx) | 76 ds = datastore.Get(ctx) |
| 70 So(ds.MakeKey("Hello", "world").Namespace(), ShouldEqual
, "wat") | 77 So(ds.MakeKey("Hello", "world").Namespace(), ShouldEqual
, "wat") |
| 71 }) | 78 }) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 226 |
| 220 Convey("memcache: Set (nil) is the same as Set ([]byte{})", func
() { | 227 Convey("memcache: Set (nil) is the same as Set ([]byte{})", func
() { |
| 221 So(mc.Set(mc.NewItem("bob")), ShouldBeNil) // normally w
ould panic because Value is nil | 228 So(mc.Set(mc.NewItem("bob")), ShouldBeNil) // normally w
ould panic because Value is nil |
| 222 | 229 |
| 223 bob, err := mc.Get("bob") | 230 bob, err := mc.Get("bob") |
| 224 So(err, ShouldBeNil) | 231 So(err, ShouldBeNil) |
| 225 So(bob.Value(), ShouldResemble, []byte{}) | 232 So(bob.Value(), ShouldResemble, []byte{}) |
| 226 }) | 233 }) |
| 227 }) | 234 }) |
| 228 } | 235 } |
| OLD | NEW |