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/prod/everything_test.go

Issue 1494223002: Add API to allow you to get the non-transactional datastore or taskqueue. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix doc and naming Created 5 years 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/prod/context.go ('k') | impl/prod/raw_datastore.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/prod/everything_test.go
diff --git a/impl/prod/everything_test.go b/impl/prod/everything_test.go
index 53024339c1d8df023e4ab33c0e0769d40e307435..577c3f46c14c4e7cead3c754d88c68bac9f25d31 100644
--- a/impl/prod/everything_test.go
+++ b/impl/prod/everything_test.go
@@ -63,6 +63,29 @@ func TestBasicDatastore(t *testing.T) {
So(ds.MakeKey("Hello", "world").Namespace(), ShouldEqual, "wat")
})
+ Convey("Can get non-transactional context", func() {
+ ctx, err := inf.Namespace("foo")
+ So(err, ShouldBeNil)
+ ds = datastore.Get(ctx)
+ inf = info.Get(ctx)
+
+ ds.RunInTransaction(func(ctx context.Context) error {
+ So(ds.MakeKey("Foo", "bar").Namespace(), ShouldEqual, "foo")
+
+ So(ds.Put(&TestStruct{ValueI: []int64{100}}), ShouldBeNil)
+
+ err = datastore.GetNoTxn(ctx).RunInTransaction(func(ctx context.Context) error {
+ ds = datastore.Get(ctx)
+ So(ds.MakeKey("Foo", "bar").Namespace(), ShouldEqual, "foo")
+ So(ds.Put(&TestStruct{ValueI: []int64{100}}), ShouldBeNil)
+ return nil
+ }, nil)
+ So(err, ShouldBeNil)
+
+ return nil
+ }, nil)
+ })
+
Convey("Can Put/Get", func() {
orig := TestStruct{
ValueI: []int64{1, 7, 946688461000000, 996688461000000},
« no previous file with comments | « impl/prod/context.go ('k') | impl/prod/raw_datastore.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698