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

Unified Diff: impl/memory/datastore_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/memory/datastore.go ('k') | impl/memory/taskqueue.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/datastore_test.go
diff --git a/impl/memory/datastore_test.go b/impl/memory/datastore_test.go
index fda5b4969f3fe6da289d25ea1853de458003ba5b..681554de21d5c5d26b93dd4b86230f654642f601 100644
--- a/impl/memory/datastore_test.go
+++ b/impl/memory/datastore_test.go
@@ -255,17 +255,17 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
Convey("Get takes a snapshot", func() {
err := ds.RunInTransaction(func(c context.Context) error {
- txnDS := dsS.Get(c)
+ ds := dsS.Get(c)
- So(txnDS.Get(f), ShouldBeNil)
+ So(ds.Get(f), ShouldBeNil)
So(f.Val, ShouldEqual, 10)
// Don't ever do this in a real program unless you want to guarantee
// a failed transaction :)
f.Val = 11
- So(ds.Put(f), ShouldBeNil)
+ So(dsS.GetNoTxn(c).Put(f), ShouldBeNil)
- So(txnDS.Get(f), ShouldBeNil)
+ So(ds.Get(f), ShouldBeNil)
So(f.Val, ShouldEqual, 10)
return nil
@@ -279,24 +279,24 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
Convey("and snapshots are consistent even after Puts", func() {
err := ds.RunInTransaction(func(c context.Context) error {
- txnDS := dsS.Get(c)
+ ds := dsS.Get(c)
f := &Foo{ID: 1}
- So(txnDS.Get(f), ShouldBeNil)
+ So(ds.Get(f), ShouldBeNil)
So(f.Val, ShouldEqual, 10)
// Don't ever do this in a real program unless you want to guarantee
// a failed transaction :)
f.Val = 11
- So(ds.Put(f), ShouldBeNil)
+ So(dsS.GetNoTxn(c).Put(f), ShouldBeNil)
- So(txnDS.Get(f), ShouldBeNil)
+ So(ds.Get(f), ShouldBeNil)
So(f.Val, ShouldEqual, 10)
f.Val = 20
- So(txnDS.Put(f), ShouldBeNil)
+ So(ds.Put(f), ShouldBeNil)
- So(txnDS.Get(f), ShouldBeNil)
+ So(ds.Get(f), ShouldBeNil)
So(f.Val, ShouldEqual, 10) // still gets 10
return nil
@@ -341,7 +341,7 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
err := ds.RunInTransaction(func(c context.Context) error {
So(dsS.Get(c).Put(&Foo{ID: 1, Val: 21}), ShouldBeNil)
- err := ds.RunInTransaction(func(c context.Context) error {
+ err := dsS.GetNoTxn(c).RunInTransaction(func(c context.Context) error {
So(dsS.Get(c).Put(&Foo{ID: 1, Val: 27}), ShouldBeNil)
return nil
}, nil)
@@ -421,7 +421,7 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
tst := ds.Testable()
Reset(func() { tst.SetTransactionRetryCount(0) })
- Convey("SetTransactionRetryCount set to zere", func() {
+ Convey("SetTransactionRetryCount set to zero", func() {
tst.SetTransactionRetryCount(0)
calls := 0
So(ds.RunInTransaction(func(c context.Context) error {
« no previous file with comments | « impl/memory/datastore.go ('k') | impl/memory/taskqueue.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698