Skip to content

Commit

Permalink
Add maxlag regexp tests
Browse files Browse the repository at this point in the history
Bug: T144023
Change-Id: Iacd0cadca90b3b7debafcb2d3e4f95352b356bb1
  • Loading branch information
valhallasw committed Aug 28, 2016
1 parent 76279dd commit 0d5fa8f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,18 @@ def test_valid_lagpattern(self):
self.assertIsInstance(value, int)
self.assertGreaterEqual(value, 0)

def test_individual_patterns(self):
"""Test api.lagpattern with example patterns."""
patterns = {
'Waiting for 10.64.32.115: 0.14024019241333 seconds lagged': 0,
'Waiting for hostname: 5 seconds lagged': 5,
'Waiting for 127.0.0.1: 1.7 seconds lagged': 1
}
for info, time in patterns.items():
lag = api.lagpattern.search(info)
self.assertIsNotNone(lag)
self.assertEqual(int(lag.group("lag")), time)


if __name__ == '__main__': # pragma: no cover
try:
Expand Down

0 comments on commit 0d5fa8f

Please sign in to comment.