| 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 "bytes" | 8 "bytes" |
| 9 "encoding/binary" | 9 "encoding/binary" |
| 10 "errors" | 10 "errors" |
| 11 "testing" | 11 "testing" |
| 12 "time" | 12 "time" |
| 13 | 13 |
| 14 "github.com/luci/luci-go/common/config" | |
| 15 "github.com/luci/luci-go/logdog/common/storage" | 14 "github.com/luci/luci-go/logdog/common/storage" |
| 16 "github.com/luci/luci-go/logdog/common/types" | 15 "github.com/luci/luci-go/logdog/common/types" |
| 16 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 17 | 17 |
| 18 . "github.com/luci/luci-go/common/testing/assertions" | 18 . "github.com/luci/luci-go/common/testing/assertions" |
| 19 . "github.com/smartystreets/goconvey/convey" | 19 . "github.com/smartystreets/goconvey/convey" |
| 20 ) | 20 ) |
| 21 | 21 |
| 22 func numRec(v types.MessageIndex) *rec { | 22 func numRec(v types.MessageIndex) *rec { |
| 23 buf := bytes.Buffer{} | 23 buf := bytes.Buffer{} |
| 24 binary.Write(&buf, binary.BigEndian, v) | 24 binary.Write(&buf, binary.BigEndian, v) |
| 25 return &rec{ | 25 return &rec{ |
| 26 index: v, | 26 index: v, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 45 return idx | 45 return idx |
| 46 } | 46 } |
| 47 | 47 |
| 48 func TestBigTable(t *testing.T) { | 48 func TestBigTable(t *testing.T) { |
| 49 t.Parallel() | 49 t.Parallel() |
| 50 | 50 |
| 51 Convey(`A memory Storage instance.`, t, func() { | 51 Convey(`A memory Storage instance.`, t, func() { |
| 52 st := Storage{} | 52 st := Storage{} |
| 53 defer st.Close() | 53 defer st.Close() |
| 54 | 54 |
| 55 » » project := config.ProjectName("test-project") | 55 » » project := cfgtypes.ProjectName("test-project") |
| 56 path := types.StreamPath("testing/+/foo/bar") | 56 path := types.StreamPath("testing/+/foo/bar") |
| 57 | 57 |
| 58 Convey(`Can Put() log stream records {0..5, 7, 8, 10}.`, func()
{ | 58 Convey(`Can Put() log stream records {0..5, 7, 8, 10}.`, func()
{ |
| 59 var indices []types.MessageIndex | 59 var indices []types.MessageIndex |
| 60 | 60 |
| 61 putRange := func(start types.MessageIndex, count int) er
ror { | 61 putRange := func(start types.MessageIndex, count int) er
ror { |
| 62 req := storage.PutRequest{ | 62 req := storage.PutRequest{ |
| 63 Project: project, | 63 Project: project, |
| 64 Path: path, | 64 Path: path, |
| 65 Index: start, | 65 Index: start, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 st.SetErr(nil) | 216 st.SetErr(nil) |
| 217 So(st.Config(storage.Config{}), ShouldBeNil) | 217 So(st.Config(storage.Config{}), ShouldBeNil) |
| 218 | 218 |
| 219 st.SetErr(errors.New("test error")) | 219 st.SetErr(errors.New("test error")) |
| 220 So(st.Config(storage.Config{}), ShouldErrLike, "
test error") | 220 So(st.Config(storage.Config{}), ShouldErrLike, "
test error") |
| 221 }) | 221 }) |
| 222 }) | 222 }) |
| 223 }) | 223 }) |
| 224 } | 224 } |
| OLD | NEW |