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 pubsub | 5 package pubsub |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "compress/zlib" | 9 "compress/zlib" |
10 "errors" | 10 "errors" |
11 "fmt" | 11 "fmt" |
12 "io/ioutil" | 12 "io/ioutil" |
13 "sync" | 13 "sync" |
14 "testing" | 14 "testing" |
15 "time" | 15 "time" |
16 | 16 |
| 17 "cloud.google.com/go/pubsub" |
17 "github.com/golang/protobuf/proto" | 18 "github.com/golang/protobuf/proto" |
18 "github.com/luci/luci-go/common/clock" | 19 "github.com/luci/luci-go/common/clock" |
19 "github.com/luci/luci-go/common/clock/testclock" | 20 "github.com/luci/luci-go/common/clock/testclock" |
20 "github.com/luci/luci-go/common/data/recordio" | 21 "github.com/luci/luci-go/common/data/recordio" |
21 gcps "github.com/luci/luci-go/common/gcloud/pubsub" | 22 gcps "github.com/luci/luci-go/common/gcloud/pubsub" |
22 "github.com/luci/luci-go/common/proto/google" | 23 "github.com/luci/luci-go/common/proto/google" |
23 "github.com/luci/luci-go/logdog/api/logpb" | 24 "github.com/luci/luci-go/logdog/api/logpb" |
24 . "github.com/smartystreets/goconvey/convey" | 25 . "github.com/smartystreets/goconvey/convey" |
25 "golang.org/x/net/context" | 26 "golang.org/x/net/context" |
26 "google.golang.org/cloud/pubsub" | |
27 ) | 27 ) |
28 | 28 |
29 type testTopic struct { | 29 type testTopic struct { |
30 sync.Mutex | 30 sync.Mutex |
31 | 31 |
32 err error | 32 err error |
33 | 33 |
34 msgC chan *pubsub.Message | 34 msgC chan *pubsub.Message |
35 nextMessageID int | 35 nextMessageID int |
36 } | 36 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 So(st.DiscardedMessages(), ShouldEqual, 0) | 141 So(st.DiscardedMessages(), ShouldEqual, 0) |
142 }) | 142 }) |
143 }) | 143 }) |
144 | 144 |
145 Convey(`Will return an error if Publish failed.`, func() { | 145 Convey(`Will return an error if Publish failed.`, func() { |
146 tt.err = errors.New("test: error") | 146 tt.err = errors.New("test: error") |
147 So(o.SendBundle(bundle), ShouldNotBeNil) | 147 So(o.SendBundle(bundle), ShouldNotBeNil) |
148 }) | 148 }) |
149 }) | 149 }) |
150 } | 150 } |
OLD | NEW |