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

Unified Diff: go/src/infra/gae/libs/wrapper/memory/datastore_test.go

Issue 1159343002: Fix tests to run on 32 bits. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/gae/libs/wrapper/memory/datastore_test.go
diff --git a/go/src/infra/gae/libs/wrapper/memory/datastore_test.go b/go/src/infra/gae/libs/wrapper/memory/datastore_test.go
index c7d2bca542a1cdb9789506311244628384fbd03e..ebd01ab1b2fe50c217933f0ff700e9fb52bfa9ef 100644
--- a/go/src/infra/gae/libs/wrapper/memory/datastore_test.go
+++ b/go/src/infra/gae/libs/wrapper/memory/datastore_test.go
@@ -8,6 +8,7 @@ import (
"fmt"
"infra/gae/libs/meta"
"infra/gae/libs/wrapper"
+ "math"
"testing"
. "github.com/smartystreets/goconvey/convey"
@@ -525,6 +526,7 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
const MaxUint = ^uint(0)
const MaxInt = int(MaxUint >> 1)
+const IntIs32Bits = MaxInt < math.MaxInt64
func TestDatastoreQueryer(t *testing.T) {
Convey("Datastore Query suport", t, func() {
@@ -596,16 +598,22 @@ func TestDatastoreQueryer(t *testing.T) {
So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "empty order")
})
Convey("OOB limit", func() {
- q := q.Limit(MaxInt)
- So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "query limit overflow")
+ // this is supremely stupid. The SDK uses 'int' which measn we have to
M-A Ruel 2015/06/01 13:08:20 means
+ // use it too, but then THEY BOUNDS CHECK IT FOR 32 BITS... *sigh*
M-A Ruel 2015/06/01 13:08:19 bah, 2 millions items is large. it's probably more
+ if !IntIs32Bits {
+ q := q.Limit(MaxInt)
+ So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "query limit overflow")
+ }
})
Convey("underflow offset", func() {
q := q.Offset(-29)
So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "negative query offset")
})
Convey("OOB offset", func() {
- q := q.Offset(MaxInt)
- So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "query offset overflow")
+ if !IntIs32Bits {
+ q := q.Offset(MaxInt)
+ So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "query offset overflow")
+ }
})
Convey("Bad cursors", func() {
q := q.Start(queryCursor("")).End(queryCursor(""))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698