testExecuteTimeout fixed: give a test still 1 second, because system could be too busy

pull/830/head
sebres 11 years ago committed by sebres
parent bef0502e6b
commit 07d4badfd0

@ -186,8 +186,10 @@ class CommandActionTest(LogCaptureTestCase):
# Should take a minute
self.assertRaises(
RuntimeError, CommandAction.executeCmd, 'sleep 60', timeout=2)
self.assertAlmostEqual(time.time() - stime, 2, places=0)
self.assertTrue(self._is_logged('sleep 60 -- timed out after 2 seconds'))
# give a test still 1 second, because system could be too busy
self.assertTrue(time.time() >= stime + 2 and time.time() <= stime + 3)
self.assertTrue(self._is_logged('sleep 60 -- timed out after 2 seconds')
or self._is_logged('sleep 60 -- timed out after 3 seconds'))
self.assertTrue(self._is_logged('sleep 60 -- killed with SIGTERM'))
def testCaptureStdOutErr(self):

Loading…
Cancel
Save