Index: impl/prod/everything_test.go |
diff --git a/impl/prod/everything_test.go b/impl/prod/everything_test.go |
index 05623f7fdf01823c77e991fe858e286bd129f050..00e3c605f561a3df25db41c70e5a3d05c458bb9c 100644 |
--- a/impl/prod/everything_test.go |
+++ b/impl/prod/everything_test.go |
@@ -19,6 +19,7 @@ import ( |
"golang.org/x/net/context" |
"google.golang.org/appengine/aetest" |
+ "google.golang.org/appengine/datastore" |
. "github.com/smartystreets/goconvey/convey" |
) |
@@ -281,6 +282,39 @@ func TestBasicDatastore(t *testing.T) { |
}) |
} |
+func TestRawAppEngineAccess(t *testing.T) { |
+ t.Parallel() |
+ |
+ Convey("An AppEngine testing instance bound to a Context with services installed", t, func() { |
+ inst, err := aetest.NewInstance(&aetest.Options{ |
+ StronglyConsistentDatastore: true, |
+ }) |
+ So(err, ShouldBeNil) |
+ defer inst.Close() |
+ |
+ req, err := inst.NewRequest("GET", "/", nil) |
+ So(err, ShouldBeNil) |
+ |
+ ctx := Use(context.Background(), req) |
+ |
+ Convey("Can issue a raw datastore Put/Get", func() { |
+ key := datastore.NewKey(ctx, "Test", "foo", 0, nil) |
+ obj := struct { |
+ A string |
+ B int64 |
+ C time.Time |
+ }{"bar", 1337, ds.RoundTime(time.Date(1938, time.January, 1, 1, 1, 1, 1, time.UTC))} |
+ _, err := datastore.Put(ctx, key, &obj) |
+ So(err, ShouldBeNil) |
+ |
+ other := obj |
+ other.A, other.B, other.C = "", 0, time.Time{} |
+ So(datastore.Get(ctx, key, &other), ShouldBeNil) |
+ So(other, ShouldResemble, obj) |
+ }) |
+ }) |
+} |
+ |
func BenchmarkTransactionsParallel(b *testing.B) { |
type Counter struct { |
ID int `gae:"$id"` |