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