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

Unified Diff: common/tsmon/metric/standard_metrics_test.go

Issue 2290993002: Always set presence/up from go tsmon apps. (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/tsmon/metric/standard_metrics.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/tsmon/metric/standard_metrics_test.go
diff --git a/common/tsmon/metric/standard_metrics_test.go b/common/tsmon/metric/standard_metrics_test.go
index 58635538126830c007c6ddc83bdd688b629ce4dc..1c3f8893a5ecd4e8e79ebaaa5cb381c30616cb54 100644
--- a/common/tsmon/metric/standard_metrics_test.go
+++ b/common/tsmon/metric/standard_metrics_test.go
@@ -8,6 +8,9 @@ import (
"testing"
"time"
+ "github.com/luci/luci-go/common/tsmon"
+ "golang.org/x/net/context"
+
. "github.com/smartystreets/goconvey/convey"
)
@@ -18,15 +21,15 @@ func TestStandardMetrics(t *testing.T) {
dur := time.Duration(durMillis * float64(time.Millisecond))
Convey("UpdatePresenceMetrics updates presenceMetric", t, func() {
- c := makeContext() // Defined in metrics_test.go
- v, err := presenceMetric.Get(c)
- So(v, ShouldEqual, false)
- So(err, ShouldBeNil)
+ c, m := tsmon.WithDummyInMemory(context.Background())
+ registerCallbacks(c)
- UpdatePresenceMetrics(c)
- v, err = presenceMetric.Get(c)
- So(v, ShouldEqual, true)
- So(err, ShouldBeNil)
+ So(tsmon.Flush(c), ShouldBeNil)
+
+ So(len(m.Cells), ShouldEqual, 1)
+ So(len(m.Cells[0]), ShouldEqual, 1)
+ So(m.Cells[0][0].Name, ShouldEqual, "presence/up")
+ So(m.Cells[0][0].Value, ShouldEqual, true)
})
Convey("UpdateHTTPMetrics updates client metrics", t, func() {
« no previous file with comments | « common/tsmon/metric/standard_metrics.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698