| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 | 9 |
| 10 "github.com/golang/protobuf/proto" |
| 10 "github.com/luci/luci-go/common/tsmon" | 11 "github.com/luci/luci-go/common/tsmon" |
| 11 "github.com/luci/luci-go/common/tsmon/monitor" | 12 "github.com/luci/luci-go/common/tsmon/monitor" |
| 12 "github.com/luci/luci-go/common/tsmon/store" | 13 "github.com/luci/luci-go/common/tsmon/store" |
| 13 "github.com/luci/luci-go/common/tsmon/target" | 14 "github.com/luci/luci-go/common/tsmon/target" |
| 14 | 15 |
| 15 . "github.com/smartystreets/goconvey/convey" | 16 . "github.com/smartystreets/goconvey/convey" |
| 16 ) | 17 ) |
| 17 | 18 |
| 18 func TestStandardMetrics(t *testing.T) { | 19 func TestStandardMetrics(t *testing.T) { |
| 19 Convey("Default version", t, func() { | 20 Convey("Default version", t, func() { |
| 20 c, _ := buildGAETestContext() | 21 c, _ := buildGAETestContext() |
| 21 » » tsmon.GetState(c).S = store.NewInMemory(&target.Task{ServiceName
: "default target"}) | 22 » » tsmon.GetState(c).S = store.NewInMemory(&target.Task{ServiceName
: proto.String("default target")}) |
| 22 standardMetricsCallback(c) | 23 standardMetricsCallback(c) |
| 23 tsmon.Flush(c) | 24 tsmon.Flush(c) |
| 24 | 25 |
| 25 monitor := tsmon.GetState(c).M.(*monitor.Fake) | 26 monitor := tsmon.GetState(c).M.(*monitor.Fake) |
| 26 So(len(monitor.Cells), ShouldEqual, 1) | 27 So(len(monitor.Cells), ShouldEqual, 1) |
| 27 So(monitor.Cells[0][0].Name, ShouldEqual, "appengine/default_ver
sion") | 28 So(monitor.Cells[0][0].Name, ShouldEqual, "appengine/default_ver
sion") |
| 28 So(monitor.Cells[0][0].Value, ShouldEqual, "testVersion1") | 29 So(monitor.Cells[0][0].Value, ShouldEqual, "testVersion1") |
| 29 }) | 30 }) |
| 30 } | 31 } |
| OLD | NEW |