Beispiel #1
0
    def test_process_cluster_no_change(self):
        action = ActionReorder(self.args, self.cluster)
        action.process_cluster()

        b1 = self.cluster.brokers[1]
        b2 = self.cluster.brokers[2]
        assert self.cluster.topics['testTopic1'].partitions[0].replicas == [
            b1, b2
        ]
        assert self.cluster.topics['testTopic1'].partitions[1].replicas == [
            b2, b1
        ]
        assert self.cluster.topics['testTopic2'].partitions[0].replicas == [
            b2, b1
        ]
        assert self.cluster.topics['testTopic2'].partitions[1].replicas == [
            b1, b2
        ]
Beispiel #2
0
    def test_process_cluster(self):
        b1 = self.cluster.brokers[1]
        b2 = self.cluster.brokers[2]
        self.cluster.topics['testTopic1'].partitions[0].swap_replica_positions(
            b1, b2)

        action = ActionReorder(self.args, self.cluster)
        action.process_cluster()

        assert self.cluster.topics['testTopic1'].partitions[0].replicas == [
            b2, b1
        ]
        assert self.cluster.topics['testTopic1'].partitions[1].replicas == [
            b1, b2
        ]
        assert self.cluster.topics['testTopic2'].partitions[0].replicas == [
            b2, b1
        ]
        assert self.cluster.topics['testTopic2'].partitions[1].replicas == [
            b1, b2
        ]
Beispiel #3
0
    def __init__(self, args, cluster):
        super(ActionBalanceLeader, self).__init__(args, cluster)

        # This module merely calls the main "reorder" module, so we're going to instantiate a copy of that
        self._reorder = ActionReorder(args, cluster)
Beispiel #4
0
 def test_create_class(self):
     action = ActionReorder(self.args, self.cluster)
     assert isinstance(action, ActionReorder)