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

Side by Side Diff: impl/memory/datastore_test.go

Issue 2219673002: Remove empty namespace assertion from impl/memory. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « impl/memory/datastore.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « impl/memory/datastore.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698