| Index: go/src/infra/gae/libs/meta/eg_test.go
|
| diff --git a/go/src/infra/gae/libs/meta/eg_test.go b/go/src/infra/gae/libs/meta/eg_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..96e82c747dea675aca944204542c6239c8dc498b
|
| --- /dev/null
|
| +++ b/go/src/infra/gae/libs/meta/eg_test.go
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package meta
|
| +
|
| +import (
|
| + "golang.org/x/net/context"
|
| + "testing"
|
| +
|
| + "infra/gae/libs/wrapper"
|
| + "infra/gae/libs/wrapper/memory"
|
| +
|
| + . "github.com/smartystreets/goconvey/convey"
|
| +)
|
| +
|
| +func TestGetEntityGroupVersion(t *testing.T) {
|
| + Convey("GetEntityGroupVersion", t, func() {
|
| + c := memory.Use(memory.Enable(context.Background()))
|
| + ds := wrapper.DS(c)
|
| +
|
| + type A struct {
|
| + ID int64 `datastore:"-" goon:"id"`
|
| + Val int
|
| + }
|
| +
|
| + a := &A{Val: 10}
|
| + aKey, err := ds.Put(a)
|
| + So(err, ShouldBeNil)
|
| +
|
| + v, err := GetEntityGroupVersion(c, aKey)
|
| + So(err, ShouldBeNil)
|
| + So(v, ShouldEqual, 1)
|
| +
|
| + So(ds.Delete(aKey), ShouldBeNil)
|
| +
|
| + v, err = GetEntityGroupVersion(c, ds.NewKey("madeUp", "thing", 0, aKey))
|
| + So(err, ShouldBeNil)
|
| + So(v, ShouldEqual, 2)
|
| +
|
| + v, err = GetEntityGroupVersion(c, ds.NewKey("madeUp", "thing", 0, nil))
|
| + So(err, ShouldBeNil)
|
| + So(v, ShouldEqual, 0)
|
| +
|
| + tDs := ds.(wrapper.Testable)
|
| + tDs.SetBrokenFeatures("Get")
|
| +
|
| + v, err = GetEntityGroupVersion(c, aKey)
|
| + So(err.Error(), ShouldContainSubstring, "INTERNAL_ERROR")
|
| + })
|
| +}
|
|
|