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

Unified Diff: impl/memory/datastore_test.go

Issue 1574353004: GitHub #8: Seed indexes from index.yml (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Created 4 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
Index: impl/memory/datastore_test.go
diff --git a/impl/memory/datastore_test.go b/impl/memory/datastore_test.go
index 2f22e3dedc72c2fee1e1de93ec3cff256c3eeada..c84ce087623e1efaab0e68b48436ebc5f975aee8 100644
--- a/impl/memory/datastore_test.go
+++ b/impl/memory/datastore_test.go
@@ -5,6 +5,7 @@
package memory
import (
+ "bytes"
"fmt"
"testing"
"time"
@@ -528,6 +529,80 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
So(err, ShouldBeNil)
So(count, ShouldEqual, 1) // normally this would include __entity_group__
})
+
+ Convey("Testable.ParseIndexYAML", func() {
+ yaml := `
+indexes:
+
+- kind: Cat
+ ancestor: no
+ properties:
+ - name: name
+ - name: age
+ direction: desc
+
+- kind: Cat
+ properties:
+ - name: name
+ direction: asc
+ - name: whiskers
+ direction: desc
+
+- kind: Store
+ ancestor: yes
+ properties:
+ - name: business
+ direction: asc
+ - name: owner
+ direction: asc
+`
+ idxs := ds.Testable().ParseIndexYAML(bytes.NewBufferString(yaml))
+ expected := []*dsS.IndexDefinition{
+ {
+ Kind: "Cat",
+ Ancestor: false,
+ SortBy: []dsS.IndexColumn{
+ {
+ Property: "name",
+ Descending: false,
+ },
+ {
+ Property: "age",
+ Descending: true,
+ },
+ },
+ },
+ {
+ Kind: "Cat",
+ Ancestor: false,
+ SortBy: []dsS.IndexColumn{
+ {
+ Property: "name",
+ Descending: false,
+ },
+ {
+ Property: "whiskers",
+ Descending: true,
+ },
+ },
+ },
+ {
+ Kind: "Store",
+ Ancestor: true,
+ SortBy: []dsS.IndexColumn{
+ {
+ Property: "business",
+ Descending: false,
+ },
+ {
+ Property: "owner",
+ Descending: false,
+ },
+ },
+ },
+ }
+ So(idxs, ShouldResembleV, expected)
+ })
})
dnj 2016/01/13 16:16:40 Also test filesystem walking using a tempdir.
nishanths (utexas) 2016/01/14 21:15:14 Done. :) The tests are now in service/datastore/da
}

Powered by Google App Engine
This is Rietveld 408576698