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

Unified Diff: impl/memory/datastore_index_test.go

Issue 2604943002: impl/memory: Replace gkvlite with "treapstore". (Closed)
Patch Set: Comments. Created 3 years, 11 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 | « impl/memory/datastore_index.go ('k') | impl/memory/datastore_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/datastore_index_test.go
diff --git a/impl/memory/datastore_index_test.go b/impl/memory/datastore_index_test.go
index 2d69f1d2293df72b572b506765c6e975cf744a2d..63c8ba5ff8d0495500decfa5f05905b7447da563 100644
--- a/impl/memory/datastore_index_test.go
+++ b/impl/memory/datastore_index_test.go
@@ -11,7 +11,7 @@ import (
ds "github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/datastore/serialize"
- "github.com/luci/gkvlite"
+
. "github.com/smartystreets/goconvey/convey"
)
@@ -205,12 +205,10 @@ func TestIndexRowGen(t *testing.T) {
Convey("indexEntries", func() {
sip := serialize.PropertyMapPartially(fakeKey, nil)
s := indexEntries(fakeKey, sip, defaultIndexes("knd", ds.PropertyMap(nil)))
- numItems, _ := s.GetCollection("idx").GetTotals()
- So(numItems, ShouldEqual, 1)
- itm := s.GetCollection("idx").MinItem(false)
- So(itm.Key, ShouldResemble, cat(indx("knd").PrepForIdxTable()))
- numItems, _ = s.GetCollection("idx:ns:" + string(itm.Key)).GetTotals()
- So(numItems, ShouldEqual, 1)
+ So(countItems(s.Snapshot().GetCollection("idx")), ShouldEqual, 1)
+ itm := s.GetCollection("idx").MinItem()
+ So(itm.key, ShouldResemble, cat(indx("knd").PrepForIdxTable()))
+ So(countItems(s.Snapshot().GetCollection("idx:ns:"+string(itm.key))), ShouldEqual, 1)
})
Convey("defaultIndexes", func() {
@@ -253,10 +251,10 @@ func TestIndexEntries(t *testing.T) {
for colName, vals := range tc.collections {
i := 0
coll := store.Snapshot().GetCollection(colName)
- numItems, _ := coll.GetTotals()
- So(numItems, ShouldEqual, len(tc.collections[colName]))
- coll.VisitItemsAscend(nil, true, func(itm *gkvlite.Item) bool {
- So(itm.Key, ShouldResemble, vals[i])
+ So(countItems(coll), ShouldEqual, len(tc.collections[colName]))
+
+ coll.ForEachItem(func(k, _ []byte) bool {
+ So(k, ShouldResemble, vals[i])
i++
return true
})
@@ -372,8 +370,8 @@ func TestUpdateIndexes(t *testing.T) {
coll := store.Snapshot().GetCollection(colName)
So(coll, ShouldNotBeNil)
i := 0
- coll.VisitItemsAscend(nil, false, func(itm *gkvlite.Item) bool {
- So(data[i], ShouldResemble, itm.Key)
+ coll.ForEachItem(func(k, _ []byte) bool {
+ So(data[i], ShouldResemble, k)
i++
return true
})
« no previous file with comments | « impl/memory/datastore_index.go ('k') | impl/memory/datastore_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698