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

Side by Side Diff: common/tsmon/flush_test.go

Issue 1854583002: Migrate tsmon protos to proto3 (Closed) Base URL: git@github.com:luci/luci-go.git@master
Patch Set: Created 4 years, 8 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 | « common/tsmon/field/field_test.go ('k') | common/tsmon/metric/metric_test.go » ('j') | 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 Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package tsmon 5 package tsmon
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 "time" 9 "time"
10 10
11 "github.com/golang/protobuf/proto"
12 "golang.org/x/net/context" 11 "golang.org/x/net/context"
13 12
14 "github.com/luci/luci-go/common/clock" 13 "github.com/luci/luci-go/common/clock"
15 "github.com/luci/luci-go/common/clock/testclock" 14 "github.com/luci/luci-go/common/clock/testclock"
16 "github.com/luci/luci-go/common/tsmon/field" 15 "github.com/luci/luci-go/common/tsmon/field"
17 "github.com/luci/luci-go/common/tsmon/target" 16 "github.com/luci/luci-go/common/tsmon/target"
18 "github.com/luci/luci-go/common/tsmon/types" 17 "github.com/luci/luci-go/common/tsmon/types"
19 18
20 pb "github.com/luci/luci-go/common/tsmon/ts_mon_proto" 19 pb "github.com/luci/luci-go/common/tsmon/ts_mon_proto"
21 20
22 . "github.com/smartystreets/goconvey/convey" 21 . "github.com/smartystreets/goconvey/convey"
23 ) 22 )
24 23
25 func TestFlush(t *testing.T) { 24 func TestFlush(t *testing.T) {
26 c := context.Background() 25 c := context.Background()
27 26
28 » defaultTarget := (*target.Task)(&pb.Task{ 27 » defaultTarget := (*target.Task)(&pb.Task{ServiceName: "test"})
29 » » ServiceName: proto.String("test"),
30 » })
31 28
32 Convey("Sends a metric", t, func() { 29 Convey("Sends a metric", t, func() {
33 c, s, m := WithFakes(c) 30 c, s, m := WithFakes(c)
34 s.Cells = []types.Cell{ 31 s.Cells = []types.Cell{
35 { 32 {
36 types.MetricInfo{ 33 types.MetricInfo{
37 Name: "foo", 34 Name: "foo",
38 Fields: []field.Field{}, 35 Fields: []field.Field{},
39 ValueType: types.StringType, 36 ValueType: types.StringType,
40 }, 37 },
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Each 'flush' gets blocked on sending into 'moments'. Once unb locked, it 149 // Each 'flush' gets blocked on sending into 'moments'. Once unb locked, it
153 // advances timer by 'interval' sec (1 sec in the test). 150 // advances timer by 'interval' sec (1 sec in the test).
154 So(<-moments, ShouldEqual, 1) 151 So(<-moments, ShouldEqual, 1)
155 So(<-moments, ShouldEqual, 2) 152 So(<-moments, ShouldEqual, 2)
156 // and so on ... 153 // and so on ...
157 154
158 // Doesn't timeout => works. 155 // Doesn't timeout => works.
159 flusher.stop() 156 flusher.stop()
160 }) 157 })
161 } 158 }
OLDNEW
« no previous file with comments | « common/tsmon/field/field_test.go ('k') | common/tsmon/metric/metric_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698