def test_count_partition(self): t1 = sentinel.t1 partitions = set([ Mock(spec=Partition, topic=t1, replicas=sentinel.r1), Mock(spec=Partition, topic=t1, replicas=sentinel.r1), Mock(spec=Partition, topic=sentinel.t2, replicas=sentinel.r1), ]) broker = Broker('test-broker', partitions=partitions) assert broker.count_partitions(t1) == 2 assert broker.count_partitions(sentinel.t3) == 0
def test_count_partition(self): t1 = sentinel.t1 partitions = set([ Mock(spec=Partition, topic=t1, replicas=sentinel.r1), Mock(spec=Partition, topic=t1, replicas=sentinel.r1), Mock(spec=Partition, topic=sentinel.t2, replicas=sentinel.r1), ]) broker = Broker('test-broker', partitions=partitions) assert broker.count_partitions(t1) == 2 assert broker.count_partitions(sentinel.t3) == 0
def test_count_partition(self, create_partition): p10 = create_partition('t1', 0) p11 = create_partition('t1', 1) p20 = create_partition('t2', 0) p30 = create_partition('t3', 0) t1 = p10.topic t3 = p30.topic broker = Broker('test-broker', partitions=set([p10, p11, p20])) assert broker.count_partitions(t1) == 2 assert broker.count_partitions(t3) == 0
def test_count_partition(self, create_partition): p10 = create_partition('t1', 0) p11 = create_partition('t1', 1) p20 = create_partition('t2', 0) p30 = create_partition('t3', 0) t1 = p10.topic t3 = p30.topic broker = Broker('test-broker', partitions=set([p10, p11, p20])) assert broker.count_partitions(t1) == 2 assert broker.count_partitions(t3) == 0