Test for timing

This commit is contained in:
David Buxton 2015-09-01 19:05:59 -04:00
parent 6c9e70ef34
commit befb85b3e0
2 changed files with 3 additions and 1 deletions

View File

@ -798,7 +798,7 @@ class StatusCheckResult(models.Model):
Time taken by check in ms
"""
try:
diff = (self.time_complete - self.time).microseconds
diff = self.time_complete - self.time
return (diff.microseconds + (diff.seconds + diff.days * 24 * 3600) * 10**6) / 1000
except:
return None

View File

@ -258,6 +258,8 @@ class TestCheckRun(LocalTestCase):
self.assertFalse(self.graphite_check.last_result().succeeded)
self.assertEqual(self.graphite_check.calculated_status,
Service.CALCULATED_FAILING_STATUS)
# Test results timing
self.assertGreater(list(checkresults)[-1].took, 0.0)
@patch('cabot.cabotapp.jenkins.requests.get', fake_jenkins_response)
def test_jenkins_run(self):