コード例 #1
0
ファイル: throttledlog_test.py プロジェクト: nirs/vdsm
 def test_timeout(self):
     throttledlog.throttle('test', 10, timeout=7)
     for i in range(12):
         throttledlog.debug('test', "Cycle: %s", i)
         throttledlog.monotonic_time.time += 1.0
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i,) for i in (0, 7, 10,)])
コード例 #2
0
ファイル: throttledlog_test.py プロジェクト: xin49/vdsm
 def test_timeout(self):
     throttledlog.throttle('test', 10, timeout=7)
     for i in range(12):
         throttledlog.debug('test', "Cycle: %s", i)
         throttledlog.monotonic_time.time += 1.0
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i,) for i in (0, 7, 10,)])
コード例 #3
0
 def test_default(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('other', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i, ) for i in range(5)])
コード例 #4
0
 def test_no_logging(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('test', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages, [])
コード例 #5
0
ファイル: throttledlog_test.py プロジェクト: nirs/vdsm
 def test_default(self):
     throttledlog.throttle("test", 3)
     for i in range(5):
         throttledlog.debug("other", "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages, ["Cycle: %s" % (i,) for i in range(5)])
コード例 #6
0
ファイル: throttledlog_test.py プロジェクト: nirs/vdsm
 def test_no_logging(self):
     throttledlog.throttle("test", 3)
     for i in range(5):
         throttledlog.debug("test", "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages, [])
コード例 #7
0
ファイル: throttledlog_test.py プロジェクト: nirs/vdsm
 def test_default(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('other', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i,) for i in range(5)])
コード例 #8
0
ファイル: throttledlog_test.py プロジェクト: nirs/vdsm
 def test_throttled_logging(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('test', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: 0', 'Cycle: 3'])