本文整理汇总了Python中haproxy.logfile.Log.cmd_requests_per_minute方法的典型用法代码示例。如果您正苦于以下问题:Python Log.cmd_requests_per_minute方法的具体用法?Python Log.cmd_requests_per_minute怎么用?Python Log.cmd_requests_per_minute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类haproxy.logfile.Log
的用法示例。
在下文中一共展示了Log.cmd_requests_per_minute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cmd_requests_per_minute
# 需要导入模块: from haproxy.logfile import Log [as 别名]
# 或者: from haproxy.logfile.Log import cmd_requests_per_minute [as 别名]
def test_cmd_requests_per_minute(self):
"""Check that the requests per minute command reports as expected."""
log_file = Log(
logfile='haproxy/tests/files/requests_per_minute.log',
)
requests = log_file.cmd_requests_per_minute()
self.assertEqual(len(requests), 5)
self.assertEqual(
requests[0],
(datetime(2013, 12, 11, 11, 2), 8)
)
self.assertEqual(
requests[1],
(datetime(2013, 12, 11, 11, 3), 3)
)
self.assertEqual(
requests[2],
(datetime(2013, 12, 11, 11, 13), 5)
)
self.assertEqual(
requests[3],
(datetime(2013, 12, 11, 11, 52), 7)
)
self.assertEqual(
requests[4],
(datetime(2013, 12, 11, 12, 2), 9)
)
示例2: test_cmd_requests_per_minute_empty
# 需要导入模块: from haproxy.logfile import Log [as 别名]
# 或者: from haproxy.logfile.Log import cmd_requests_per_minute [as 别名]
def test_cmd_requests_per_minute_empty(self):
"""Check that the requests per minute command reports nothing if
there are no valid lines for whichever reason.
"""
log_file = Log(
logfile='haproxy/tests/files/empty.log',
)
requests = log_file.cmd_requests_per_minute()
self.assertEqual(None, requests)