コード例 #1
0
ファイル: test_conductor.py プロジェクト: zhouyuking/faust
 def test_update_tp_index__active_partitions_empty(self, *, con):
     assigned = {TP1, TP2}
     topic1 = Mock(name='topic1', autospec=Topic)
     topic1.active_partitions = set()
     con._topics.add(topic1)
     con._update_tp_index(assigned)
     assert topic1 not in con._tp_index[TP1]
     assert topic1 not in con._tp_index[TP2]
コード例 #2
0
ファイル: test_conductor.py プロジェクト: zhouyuking/faust
 def test_update_tp_index(self, *, con):
     assigned = {TP1, TP2}
     topic1 = Mock(name='topic1', autospec=Topic)
     topic1.topics = [TP1.topic]
     topic1.active_partitions = None
     con._topics.add(topic1)
     con._update_tp_index(assigned)
     assert topic1 in con._tp_index[TP1]
     assert topic1 in con._tp_index[TP2]
コード例 #3
0
 def test_update_tp_index__active_partitions(self, *, con):
     assigned = {TP1, TP2}
     topic1 = Mock(name="topic1", autospec=Topic)
     topic1.active_partitions = {TP1, TP2}
     con._topics.add(topic1)
     con._update_tp_index(assigned)
     assert topic1 in con._tp_index[TP1]
     assert topic1 in con._tp_index[TP2]
     con._update_tp_index(set())
コード例 #4
0
 def stream(self):
     stream = Mock(name='stream')
     stream.active_partitions = None
     return stream