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

Side by Side Diff: go/src/infra/gae/libs/meta/eg_test.go

Issue 1152383003: Simple memory testing for gae/wrapper (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@better_context_lite
Patch Set: fixes Created 5 years, 7 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
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 meta
6
7 import (
8 "golang.org/x/net/context"
9 "testing"
10
11 "infra/gae/libs/wrapper"
12 "infra/gae/libs/wrapper/memory"
13
14 . "github.com/smartystreets/goconvey/convey"
15 )
16
17 func TestGetEntityGroupVersion(t *testing.T) {
18 Convey("GetEntityGroupVersion", t, func() {
19 c := memory.Use(memory.Enable(context.Background()))
20 ds := wrapper.DS(c)
21
22 type A struct {
23 ID int64 `datastore:"-" goon:"id"`
24 Val int
25 }
26
27 a := &A{Val: 10}
28 aKey, err := ds.Put(a)
29 So(err, ShouldBeNil)
30
31 v, err := GetEntityGroupVersion(c, aKey)
32 So(err, ShouldBeNil)
33 So(v, ShouldEqual, 1)
34
35 So(ds.Delete(aKey), ShouldBeNil)
36
37 v, err = GetEntityGroupVersion(c, ds.NewKey("madeUp", "thing", 0 , aKey))
38 So(err, ShouldBeNil)
39 So(v, ShouldEqual, 2)
40
41 v, err = GetEntityGroupVersion(c, ds.NewKey("madeUp", "thing", 0 , nil))
42 So(err, ShouldBeNil)
43 So(v, ShouldEqual, 0)
44
45 tDs := ds.(wrapper.Testable)
46 tDs.SetBrokenFeatures("Get")
47
48 v, err = GetEntityGroupVersion(c, aKey)
49 So(err.Error(), ShouldContainSubstring, "INTERNAL_ERROR")
50 })
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698