8000 Add unittest for discarding timestamps in parser · insequent/client_python@52994d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52994d9

Browse files
committed
Add unittest for discarding timestamps in parser
1 parent 4916ffa commit 52994d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_parser.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ def test_escaping(self):
172172
metric_family.add_metric(["b\\a\\z"], 2)
173173
self.assertEqual([metric_family], list(families))
174174

175+
def test_timestamps_discarded(self):
176+
families = text_string_to_metric_families("""# TYPE a counter
177+
# HELP a help
178+
a{foo="bar"} 1\t000
179+
# TYPE b counter
180+
# HELP b help
181+
b 2 1234567890
182+
""")
183+
a = CounterMetricFamily("a", "help", labels=["foo"])
184+
a.add_metric(["bar"], 1)
185+
b = CounterMetricFamily("b", "help", value=2)
186+
self.assertEqual([a, b], list(families))
187+
175188
@unittest.skipIf(sys.version_info < (2, 7), "Test requires Python 2.7+.")
176189
def test_roundtrip(self):
177190
text = """# HELP go_gc_duration_seconds A summary of the GC invocation durations.

0 commit comments

Comments
 (0)
0