コード例 #1
0
ファイル: test_monitor.py プロジェクト: trauter/faust-1
 def test_init_max_assignment_latency_history__default(self):
     assert (
         Monitor(
             max_assignment_latency_history=33,
         ).max_assignment_latency_history
         == 33
     )
コード例 #2
0
ファイル: test_monitor.py プロジェクト: yishuihanhan/faust
    async def test_service_sampler(self, *, mon):
        mon = Monitor()

        i = 0
        mon.events_runtime = []
        mon.sleep = AsyncMock(name='sleep')

        def on_cleanup():
            nonlocal i
            mon.events_runtime.append(i + 0.34)
            i += 1
            if i > 10:
                mon._stopped.set()

        mon._cleanup = Mock(name='_cleanup')
        mon._cleanup.side_effect = on_cleanup

        await mon._sampler(mon)
コード例 #3
0
ファイル: test_monitor.py プロジェクト: somit/faust
    async def test_service_sampler(self, *, mon):
        mon = Monitor()

        i = 0
        mon.events_runtime = []
        mon.sleep = AsyncMock(name='sleep')

        def on_sample(prev_events, prev_messages):
            nonlocal i
            mon.events_runtime.append(i + 0.34)
            i += 1
            if i > 10:
                mon._stopped.set()
            return prev_events, prev_messages
        mon._sample = Mock(name='_sample')
        mon._sample.side_effect = on_sample

        await mon._sampler(mon)
コード例 #4
0
 def test_init_max_send_latency_history(self):
     assert (Monitor().max_send_latency_history ==
             Monitor.max_send_latency_history)
コード例 #5
0
 def test_init_max_commit_latency_history__default(self):
     assert Monitor(
         max_commit_latency_history=33, ).max_commit_latency_history == 33
コード例 #6
0
 def test_init_max_avg_history__default(self):
     assert Monitor(max_avg_history=33).max_avg_history == 33
コード例 #7
0
 def test_init_max_avg_history(self):
     assert Monitor().max_avg_history == Monitor.max_avg_history
コード例 #8
0
 def create_monitor(self, **kwargs: Any) -> Monitor:
     return Monitor(**kwargs)
コード例 #9
0
 def test_init_rebalances(self):
     assert Monitor(rebalances=99).rebalances == 99
コード例 #10
0
 def test_init_max_assignment_latency_history(self):
     assert (Monitor().max_assignment_latency_history ==
             Monitor.max_assignment_latency_history)