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

Unified Diff: logdog/common/storage/bigtable/storage_test.go

Issue 2611253005: Fix BigTable multi-entry row cached Tail. (Closed)
Patch Set: Created 3 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: logdog/common/storage/bigtable/storage_test.go
diff --git a/logdog/common/storage/bigtable/storage_test.go b/logdog/common/storage/bigtable/storage_test.go
index 372536a6aeb936876a20ce116eb9a47c83d35146..586bb8189af4cfcab30643f29252e6fb863d7bd1 100644
--- a/logdog/common/storage/bigtable/storage_test.go
+++ b/logdog/common/storage/bigtable/storage_test.go
@@ -12,6 +12,7 @@ import (
"github.com/luci/luci-go/common/config"
"github.com/luci/luci-go/common/data/recordio"
"github.com/luci/luci-go/logdog/common/storage"
+ "github.com/luci/luci-go/logdog/common/storage/memory"
"github.com/luci/luci-go/logdog/common/types"
"golang.org/x/net/context"
@@ -31,7 +32,10 @@ func TestStorage(t *testing.T) {
t.Parallel()
Convey(`A BigTable storage instance bound to a testing BigTable instance`, t, func() {
- s := NewMemoryInstance(context.Background(), Options{})
+ var cache memory.Cache
+ s := NewMemoryInstance(context.Background(), Options{
+ Cache: &cache,
+ })
defer s.Close()
project := config.ProjectName("test-project")
@@ -211,6 +215,12 @@ func TestStorage(t *testing.T) {
got, err := tail("A")
So(err, ShouldBeNil)
So(got, ShouldEqual, "4")
+
+ Convey(`(Cache) A second request also returns A{4}.`, func() {
+ got, err := tail("A")
+ So(err, ShouldBeNil)
+ So(got, ShouldEqual, "4")
+ })
})
Convey(`A tail request for "B" returns nothing (no contiguous logs).`, func() {
@@ -222,6 +232,20 @@ func TestStorage(t *testing.T) {
got, err := tail("C")
So(err, ShouldBeNil)
So(got, ShouldEqual, "2")
+
+ Convey(`(Cache) A second request also returns 2.`, func() {
+ got, err := tail("C")
+ So(err, ShouldBeNil)
+ So(got, ShouldEqual, "2")
+ })
+
+ Convey(`(Cache) After "3" is added, a second request returns 4.`, func() {
+ So(put("C", 3, "3"), ShouldBeNil)
+
+ got, err := tail("C")
+ So(err, ShouldBeNil)
+ So(got, ShouldEqual, "4")
+ })
})
Convey(`A tail request for "INVALID" errors NOT FOUND.`, func() {

Powered by Google App Engine
This is Rietveld 408576698