| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package memory | 5 package memory |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "fmt" | 9 "fmt" |
| 10 "testing" | 10 "testing" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 "$id": propNI(1), | 93 "$id": propNI(1), |
| 94 "$kind": propNI("Foo"), | 94 "$kind": propNI("Foo"), |
| 95 } | 95 } |
| 96 So(ds.Get(c, pmap), ShouldBeNil) | 96 So(ds.Get(c, pmap), ShouldBeNil) |
| 97 So(pmap, ShouldResemble, ds.PropertyMap{ | 97 So(pmap, ShouldResemble, ds.PropertyMap{ |
| 98 "$id": propNI(1), | 98 "$id": propNI(1), |
| 99 "$kind": propNI("Foo"), | 99 "$kind": propNI("Foo"), |
| 100 "Name": prop(""), | 100 "Name": prop(""), |
| 101 "Val": prop(10), | 101 "Val": prop(10), |
| 102 "Multi": ds.PropertySlice{prop("foo"), p
rop("bar")}, | 102 "Multi": ds.PropertySlice{prop("foo"), p
rop("bar")}, |
| 103 » » » » » "Key": prop(ds.KeyContext{"dev~app", "
"}.MakeKey("Bar", "Baz")), | 103 » » » » » "Key": prop(ds.MkKeyContext("dev~app",
"").MakeKey("Bar", "Baz")), |
| 104 }) | 104 }) |
| 105 }) | 105 }) |
| 106 Convey("Deleteing with a bogus key is bad", func() { | 106 Convey("Deleteing with a bogus key is bad", func() { |
| 107 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 100,
nil)), ShouldEqual, ds.ErrInvalidKey) | 107 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 100,
nil)), ShouldEqual, ds.ErrInvalidKey) |
| 108 }) | 108 }) |
| 109 Convey("Deleteing a DNE entity is fine", func() { | 109 Convey("Deleteing a DNE entity is fine", func() { |
| 110 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 0, ni
l)), ShouldBeNil) | 110 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 0, ni
l)), ShouldBeNil) |
| 111 }) | 111 }) |
| 112 | 112 |
| 113 Convey("Deleting entities from a nonexistant namespace w
orks", func() { | 113 Convey("Deleting entities from a nonexistant namespace w
orks", func() { |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 // Add "foos" to a new namespace, then confirm that it g
ets indexed. | 808 // Add "foos" to a new namespace, then confirm that it g
ets indexed. |
| 809 So(ds.Put(infoS.MustNamespace(ctx, "qux"), foos), Should
BeNil) | 809 So(ds.Put(infoS.MustNamespace(ctx, "qux"), foos), Should
BeNil) |
| 810 ds.GetTestable(ctx).CatchupIndexes() | 810 ds.GetTestable(ctx).CatchupIndexes() |
| 811 | 811 |
| 812 results = nil | 812 results = nil |
| 813 So(ds.GetAll(infoS.MustNamespace(ctx, "qux"), q, &result
s), ShouldBeNil) | 813 So(ds.GetAll(infoS.MustNamespace(ctx, "qux"), q, &result
s), ShouldBeNil) |
| 814 So(len(results), ShouldEqual, 2) | 814 So(len(results), ShouldEqual, 2) |
| 815 }) | 815 }) |
| 816 }) | 816 }) |
| 817 } | 817 } |
| OLD | NEW |