Exemple #1
0
    def test_acquire_partition_error(self, create_partition):
        p10 = create_partition('t1', 0)
        p11 = create_partition('t1', 1)
        p20 = create_partition('t2', 0)
        b1 = create_broker('b1', [p10, p11, p20])
        rg = ReplicationGroup('test_rg', set([b1]))
        b3 = create_broker('b3', [p11])

        # Not eligible because broker b3 has already a replica of partition p11
        with pytest.raises(NotEligibleGroupError):
            rg.acquire_partition(p11, b3)
Exemple #2
0
    def test_acquire_partition_error(self, create_partition):
        p10 = create_partition('t1', 0)
        p11 = create_partition('t1', 1)
        p20 = create_partition('t2', 0)
        b1 = create_broker('b1', [p10, p11, p20])
        rg = ReplicationGroup('test_rg', set([b1]))
        b3 = create_broker('b3', [p11])

        # Not eligible because broker b3 has already a replica of partition p11
        with pytest.raises(NotEligibleGroupError):
            rg.acquire_partition(p11, b3)
Exemple #3
0
    def test_acquire_partition(self, create_partition):
        p10 = create_partition('t1', 0)
        p11 = create_partition('t1', 1)
        p12 = create_partition('t1', 2)
        p13 = create_partition('t1', 3)
        p20 = create_partition('t2', 0)
        p21 = create_partition('t2', 1)
        b1 = create_broker('b1', [p10, p11, p20])
        b2 = create_broker('b2', [p12, p21])
        rg = ReplicationGroup('test_rg', set([b1, b2]))
        b3 = create_broker('b3', [p13])

        rg.acquire_partition(p13, b3)

        assert b3.empty()
        assert p13 in b2.partitions
Exemple #4
0
    def test_acquire_partition(self, create_partition):
        p10 = create_partition('t1', 0)
        p11 = create_partition('t1', 1)
        p12 = create_partition('t1', 2)
        p13 = create_partition('t1', 3)
        p20 = create_partition('t2', 0)
        p21 = create_partition('t2', 1)
        b1 = create_broker('b1', [p10, p11, p20])
        b2 = create_broker('b2', [p12, p21])
        rg = ReplicationGroup('test_rg', set([b1, b2]))
        b3 = create_broker('b3', [p13])

        rg.acquire_partition(p13, b3)

        assert b3.empty()
        assert p13 in b2.partitions