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

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

Issue 2435883002: LogDog: Fix archival Get/Tail implementations. (Closed)
Patch Set: LogDog: Fix archival Get/Tail implementations. Created 4 years, 2 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 3183b4946fee9dcbc2e2db47b33d6712a6d86b53..cde2d06aa334313f4c1506c7a91e6d4e1a8a8d04 100644
--- a/logdog/common/storage/bigtable/storage_test.go
+++ b/logdog/common/storage/bigtable/storage_test.go
@@ -149,6 +149,14 @@ func (t *btTableTest) dataMap() map[string][]byte {
return result
}
+func mustGetIndex(e *storage.Entry) types.MessageIndex {
+ idx, err := e.GetStreamIndex()
+ if err != nil {
+ panic(err)
+ }
+ return idx
+}
+
func TestStorage(t *testing.T) {
t.Parallel()
@@ -175,11 +183,11 @@ func TestStorage(t *testing.T) {
KeysOnly: keysOnly,
}
got := []string{}
- err := s.Get(req, func(idx types.MessageIndex, d []byte) bool {
+ err := s.Get(req, func(e *storage.Entry) bool {
if keysOnly {
- got = append(got, strconv.Itoa(int(idx)))
+ got = append(got, strconv.Itoa(int(mustGetIndex(e))))
} else {
- got = append(got, string(d))
+ got = append(got, string(e.D))
}
return true
})
@@ -327,8 +335,11 @@ func TestStorage(t *testing.T) {
Convey(`Testing "Tail"...`, func() {
tail := func(path string) (string, error) {
- got, _, err := s.Tail(project, types.StreamPath(path))
- return string(got), err
+ e, err := s.Tail(project, types.StreamPath(path))
+ if err != nil {
+ return "", err
+ }
+ return string(e.D), nil
}
Convey(`A tail request for "A" returns A{4}.`, func() {

Powered by Google App Engine
This is Rietveld 408576698