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

Unified Diff: infra_libs/ts_mon/common/test/metrics_test.py

Issue 2111473003: Issue 623854: Support unit annotations in ts_mon metrics (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Update sysmon to pass units for metrics and renamed MetricDataUnit to MetricsDataUnits Created 4 years, 6 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
« infra_libs/ts_mon/common/metrics.py ('K') | « infra_libs/ts_mon/common/metrics.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra_libs/ts_mon/common/test/metrics_test.py
diff --git a/infra_libs/ts_mon/common/test/metrics_test.py b/infra_libs/ts_mon/common/test/metrics_test.py
index b064caf0a92849cd07992c491b66e7d300c7a51c..3b0e0bb6d0fcd882dbb66c192a03cb77dc8ef069 100644
--- a/infra_libs/ts_mon/common/test/metrics_test.py
+++ b/infra_libs/ts_mon/common/test/metrics_test.py
@@ -62,6 +62,15 @@ class MetricTest(TestBase):
m.serialize_to(p, 1234, (('bar', 1), ('baz', False)), m.get(), t)
return str(p).splitlines()
+ def test_serialize_with_units(self):
+ t = targets.DeviceTarget('reg', 'role', 'net', 'host')
+ m = metrics.GaugeMetric('test', units=metrics.MetricsDataUnits.SECONDS)
+ m.set(1)
+ p = metrics_pb2.MetricsCollection()
+ m.serialize_to(p, 1234, (('bar', 1), ('baz', False)), m.get(), t)
+ self.assertEquals(p.data[0].units, metrics.MetricsDataUnits.SECONDS)
+ return str(p).splitlines()
Sergey Berezin 2016/06/30 19:21:26 It seems you're missing the new expectations file
ddoman 2016/07/06 03:35:37 Done.
+
def test_serialize_too_many_fields(self):
m = metrics.StringMetric('test', fields={'a': 1, 'b': 2, 'c': 3, 'd': 4})
m.set('val', fields={'e': 5, 'f': 6, 'g': 7})
« infra_libs/ts_mon/common/metrics.py ('K') | « infra_libs/ts_mon/common/metrics.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698