| 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 "fmt" | 8 "fmt" |
| 9 "testing" | 9 "testing" |
| 10 "time" | 10 "time" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 _, has := infoS.Get(c).GetNamesp
ace() | 589 _, has := infoS.Get(c).GetNamesp
ace() |
| 590 So(has, ShouldBeFalse) | 590 So(has, ShouldBeFalse) |
| 591 | 591 |
| 592 putErr, getErr, queryErr, countE
rr := run(c, txn) | 592 putErr, getErr, queryErr, countE
rr := run(c, txn) |
| 593 So(putErr, ShouldBeNil) | 593 So(putErr, ShouldBeNil) |
| 594 So(getErr, ShouldBeNil) | 594 So(getErr, ShouldBeNil) |
| 595 So(queryErr, ShouldBeNil) | 595 So(queryErr, ShouldBeNil) |
| 596 So(countErr, ShouldBeNil) | 596 So(countErr, ShouldBeNil) |
| 597 }) | 597 }) |
| 598 | 598 |
| 599 » » » » » Convey("With an non-empty namespace inst
alled, can Put, Get, Query, and Count.", func() { | 599 » » » » » Convey("With a namespace installed, can
Put, Get, Query, and Count.", func() { |
| 600 putErr, getErr, queryErr, countE
rr := run(infoS.Get(c).MustNamespace("foo"), txn) | 600 putErr, getErr, queryErr, countE
rr := run(infoS.Get(c).MustNamespace("foo"), txn) |
| 601 So(putErr, ShouldBeNil) | 601 So(putErr, ShouldBeNil) |
| 602 So(getErr, ShouldBeNil) | 602 So(getErr, ShouldBeNil) |
| 603 So(queryErr, ShouldBeNil) | 603 So(queryErr, ShouldBeNil) |
| 604 So(countErr, ShouldBeNil) | 604 So(countErr, ShouldBeNil) |
| 605 }) | 605 }) |
| 606 | |
| 607 Convey("With an empty namespace installe
d, can Put and Get, but not Query or Count.", func() { | |
| 608 putErr, getErr, queryErr, countE
rr := run(infoS.Get(c).MustNamespace(""), txn) | |
| 609 So(putErr, ShouldBeNil) | |
| 610 So(getErr, ShouldBeNil) | |
| 611 So(queryErr, ShouldErrLike, "nam
espace may not be present and empty") | |
| 612 So(countErr, ShouldErrLike, "nam
espace may not be present and empty") | |
| 613 }) | |
| 614 }) | 606 }) |
| 615 } | 607 } |
| 616 }) | 608 }) |
| 617 }) | 609 }) |
| 618 } | 610 } |
| 619 | 611 |
| 620 func TestCompoundIndexes(t *testing.T) { | 612 func TestCompoundIndexes(t *testing.T) { |
| 621 t.Parallel() | 613 t.Parallel() |
| 622 | 614 |
| 623 idxKey := func(def dsS.IndexDefinition) string { | 615 idxKey := func(def dsS.IndexDefinition) string { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 // Add "foos" to a new namespace, then confirm that it g
ets indexed. | 759 // Add "foos" to a new namespace, then confirm that it g
ets indexed. |
| 768 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).PutMulti
(foos), ShouldBeNil) | 760 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).PutMulti
(foos), ShouldBeNil) |
| 769 dsS.Get(ctx).Testable().CatchupIndexes() | 761 dsS.Get(ctx).Testable().CatchupIndexes() |
| 770 | 762 |
| 771 results = nil | 763 results = nil |
| 772 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q
, &results), ShouldBeNil) | 764 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q
, &results), ShouldBeNil) |
| 773 So(len(results), ShouldEqual, 2) | 765 So(len(results), ShouldEqual, 2) |
| 774 }) | 766 }) |
| 775 }) | 767 }) |
| 776 } | 768 } |
| OLD | NEW |