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

Unified Diff: impl/memory/datastore_query_execution_test.go

Issue 2498463003: Fix a bug where deletions weren't updating the raw Kind index. (Closed)
Patch Set: Fix Created 4 years, 1 month 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_query_execution_test.go
diff --git a/impl/memory/datastore_query_execution_test.go b/impl/memory/datastore_query_execution_test.go
index 0c9399632299ab524033dcdc94b1e620ce675b45..6e3dfc136f253ef042f676d24c0550bd128ebc4b 100644
--- a/impl/memory/datastore_query_execution_test.go
+++ b/impl/memory/datastore_query_execution_test.go
@@ -366,6 +366,12 @@ var queryExecutionTests = []qExTest{
{q: nq("__namespace__").Offset(1).Limit(1), get: []ds.PropertyMap{
pmap("$key", mkKey("dev~app", "", "__namespace__", "bob")),
}},
+ //
+ // eventual consistency; Unique/1 is deleted at HEAD. Keysonly finds it,
+ // but 'normal' doesn't.
+ {q: nq("Unique").Gt("__key__", key("AKind", 5)).Lte("__key__", key("Zeta", "prime")),
+ keys: []*ds.Key{key("Unique", 1)},
+ get: []ds.PropertyMap{}},
},
extraFns: []func(context.Context){
@@ -421,18 +427,13 @@ var queryExecutionTests = []qExTest{
{
expect: []qExpect{
- // eventual consistency; Unique/1 is deleted at HEAD. Keysonly finds it,
- // but 'normal' doesn't.
- {q: nq("Unique").Gt("__key__", key("AKind", 5)).Lte("__key__", key("Zeta", "prime")),
- keys: []*ds.Key{key("Unique", 1)},
- get: []ds.PropertyMap{}},
-
{q: nq("Kind").Eq("Val", 1, 3), get: []ds.PropertyMap{
stage1Data[0], stage2Data[2],
}},
},
},
}},
+
{"collapsed types", []qExStage{
{
putEnts: collapsedData,
@@ -483,6 +484,33 @@ var queryExecutionTests = []qExTest{
},
},
}},
+
+ {"regression: tombstones and limit/offset queries", []qExStage{
+ {
+ putEnts: []ds.PropertyMap{
+ pmap("$key", key("Kind", 1)),
+ pmap("$key", key("Kind", 2)),
+ pmap("$key", key("Kind", 3)),
+ },
+ delEnts: []*ds.Key{key("Kind", 2)},
+ },
+ {
+ expect: []qExpect{
+ {
+ q: nq("Kind").Limit(2),
+ get: []ds.PropertyMap{
+ pmap("$key", key("Kind", 1)),
+ pmap("$key", key("Kind", 3)),
+ },
+ },
+
+ {
+ q: nq("Kind").Offset(2),
+ get: []ds.PropertyMap{},
+ },
+ },
+ },
+ }},
}
func TestQueryExecution(t *testing.T) {
@@ -520,6 +548,9 @@ func TestQueryExecution(t *testing.T) {
}
}
+ if len(stage.delEnts) > 0 {
+ //fmt.Println("DELETING", stage.delEnts)
+ }
iannucci 2016/11/12 00:05:47 derp
if err := ds.Delete(c, stage.delEnts); err != nil {
panic(err)
}

Powered by Google App Engine
This is Rietveld 408576698