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

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

Issue 1162813002: Fix overflow on 32bit which causes tests to fail on 32bit. (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 57df0234fc3150687fd69667fd2f411fa9aea1fc..c7d2bca542a1cdb9789506311244628384fbd03e 100644
--- a/go/src/infra/gae/libs/wrapper/memory/datastore_test.go
+++ b/go/src/infra/gae/libs/wrapper/memory/datastore_test.go
@@ -8,7 +8,6 @@ import (
"fmt"
"infra/gae/libs/meta"
"infra/gae/libs/wrapper"
- "math"
"testing"
. "github.com/smartystreets/goconvey/convey"
@@ -524,6 +523,9 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
})
}
+const MaxUint = ^uint(0)
+const MaxInt = int(MaxUint >> 1)
+
func TestDatastoreQueryer(t *testing.T) {
Convey("Datastore Query suport", t, func() {
c := Use(context.Background())
@@ -594,7 +596,7 @@ func TestDatastoreQueryer(t *testing.T) {
So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "empty order")
})
Convey("OOB limit", func() {
- q := q.Limit(math.MaxInt64)
+ q := q.Limit(MaxInt)
So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "query limit overflow")
})
Convey("underflow offset", func() {
@@ -602,7 +604,7 @@ func TestDatastoreQueryer(t *testing.T) {
So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "negative query offset")
})
Convey("OOB offset", func() {
- q := q.Offset(math.MaxInt64)
+ q := q.Offset(MaxInt)
So(q.(*queryImpl).err.Error(), ShouldContainSubstring, "query offset overflow")
})
Convey("Bad cursors", func() {
« 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