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

Unified Diff: impl/memory/info_test.go

Issue 1871943003: Add Info Testable interface, implement for memory. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Fall through in filter. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/info.go ('k') | impl/prod/info.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/info_test.go
diff --git a/impl/memory/info_test.go b/impl/memory/info_test.go
index 6c7fbac611825bb30f14f23e1a7a23aa007a58e1..200f43764962e5d6d044fb5658c346ba61d3bdd5 100644
--- a/impl/memory/info_test.go
+++ b/impl/memory/info_test.go
@@ -25,4 +25,23 @@ func TestMustNamespace(t *testing.T) {
i.MustNamespace("invalid namespace name")
}, ShouldPanic)
})
+
+ Convey("Testable interface works", t, func() {
+ c := Use(context.Background())
+ c = useGID(c, func(mod *globalInfoData) {
+ mod.appid = "app-id"
+ })
+
+ // Default value.
+ So(info.Get(c).AppID(), ShouldEqual, "app-id")
+ So(info.Get(c).RequestID(), ShouldEqual, "test-request-id")
+
+ // Setting to "override" applies to initial context.
+ c = info.Get(c).Testable().SetRequestID("override")
+ So(info.Get(c).RequestID(), ShouldEqual, "override")
+
+ // Derive inner context, "override" applies.
+ c = info.Get(c).MustNamespace("valid_namespace_name")
+ So(info.Get(c).RequestID(), ShouldEqual, "override")
+ })
}
« no previous file with comments | « impl/memory/info.go ('k') | impl/prod/info.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698