コード例 #1
0
    def test_process_cluster_duplicates(self):
        self.args.brokers = [1]
        self.args.to_broker = 2
        action = ActionClone(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 == [b2, b1]
        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 == [b2, b1]
コード例 #2
0
    def test_process_cluster_no_change(self):
        self.cluster.add_broker(Broker(3, "brokerhost3.example.com"))
        self.args.brokers = [3]
        self.args.to_broker = 1
        action = ActionClone(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]
コード例 #3
0
ファイル: test_clone.py プロジェクト: ambroff/kafka-tools
    def test_process_cluster_clean_target(self):
        self.cluster.add_broker(Broker("brokerhost3.example.com", id=3))
        self.args.brokers = [1]
        self.args.to_broker = 3
        action = ActionClone(self.args, self.cluster)
        action.process_cluster()

        b1 = self.cluster.brokers[1]
        b2 = self.cluster.brokers[2]
        b3 = self.cluster.brokers[3]
        assert self.cluster.topics['testTopic1'].partitions[0].replicas == [b3, b1, b2]
        assert self.cluster.topics['testTopic1'].partitions[1].replicas == [b2, b3, b1]
        assert self.cluster.topics['testTopic2'].partitions[0].replicas == [b2, b3, b1]
        assert self.cluster.topics['testTopic2'].partitions[1].replicas == [b3, b1, b2]
コード例 #4
0
ファイル: test_clone.py プロジェクト: xuwenyihust/kafka-tools
    def test_process_cluster_clean_target(self):
        self.cluster.add_broker(Broker("brokerhost3.example.com", id=3))
        self.args.brokers = [1]
        self.args.to_broker = 3
        action = ActionClone(self.args, self.cluster)
        action.process_cluster()

        b1 = self.cluster.brokers[1]
        b2 = self.cluster.brokers[2]
        b3 = self.cluster.brokers[3]
        assert self.cluster.topics['testTopic1'].partitions[0].replicas == [
            b3, b1, b2
        ]
        assert self.cluster.topics['testTopic1'].partitions[1].replicas == [
            b2, b3, b1
        ]
        assert self.cluster.topics['testTopic2'].partitions[0].replicas == [
            b2, b3, b1
        ]
        assert self.cluster.topics['testTopic2'].partitions[1].replicas == [
            b3, b1, b2
        ]