def setUp(self):
        self.aparser = argparse.ArgumentParser(
            prog='kafka-assigner',
            description='Rejigger Kafka cluster partitions')
        self.subparsers = self.aparser.add_subparsers(
            help='Select manipulation module to use')
        self.args = argparse.Namespace()

        self.cluster = Cluster()
        self.plugin = PluginModule()
Example #2
0
 def setUp(self):
     self.topic = Topic('testTopic', 10)
     self.broker = Broker(1, 'brokerhost1.example.com')
     for i in range(10):
         self.topic.partitions[i].replicas = [self.broker]
     self.reassignment = Reassignment(self.topic.partitions, pause_time=0)
     self.null_plugin = PluginModule()
Example #3
0
    def setUp(self):
        self.aparser = argparse.ArgumentParser(prog='kafka-assigner', description='Rejigger Kafka cluster partitions')
        self.subparsers = self.aparser.add_subparsers(help='Select manipulation module to use')
        self.args = argparse.Namespace()

        self.cluster = Cluster()
        self.plugin = PluginModule()
Example #4
0
    def setUp(self):
        self.patcher_args = patch('kafka.tools.assigner.__main__.set_up_arguments')
        self.patcher_tools_path = patch('kafka.tools.assigner.__main__.get_tools_path')
        self.patcher_java_home = patch('kafka.tools.assigner.__main__.check_java_home')
        self.patcher_cluster = patch.object(Cluster, 'create_from_zookeeper')

        self.mock_args = self.patcher_args.start()
        self.mock_tools_path = self.patcher_tools_path.start()
        self.mock_java_home = self.patcher_java_home.start()
        self.mock_cluster = self.patcher_cluster.start()

        self.mock_tools_path.return_value = '/path/to/tools'
        self.mock_cluster.return_value = set_up_cluster()

        self.null_plugin = PluginModule()
Example #5
0
 def setUp(self):
     self.null_plugin = PluginModule()
Example #6
0
class PluginBaseTests(unittest.TestCase):
    def setUp(self):
        self.aparser = argparse.ArgumentParser(prog='kafka-assigner', description='Rejigger Kafka cluster partitions')
        self.subparsers = self.aparser.add_subparsers(help='Select manipulation module to use')
        self.args = argparse.Namespace()

        self.cluster = Cluster()
        self.plugin = PluginModule()

    def test_plugin_create(self):
        assert isinstance(self.plugin, PluginModule)

    def test_plugin_set_default_arguments(self):
        self.plugin.set_default_arguments(self.aparser)

    def test_plugin_set_arguments(self):
        self.plugin.set_arguments(self.args)

    def test_plugin_set_cluster(self):
        self.plugin.set_cluster(self.cluster)

    def test_plugin_after_sizes(self):
        self.plugin.after_sizes()

    def test_plugin_set_new_cluster(self):
        self.plugin.set_new_cluster(self.cluster)

    def test_plugin_set_batches(self):
        self.plugin.set_batches([])

    def test_plugin_before_execute_batch(self):
        self.plugin.before_execute_batch(1)

    def test_plugin_after_execute_batch(self):
        self.plugin.after_execute_batch(1)

    def test_plugin_before_ple(self):
        self.plugin.before_ple()

    def test_plugin_finished(self):
        self.plugin.finished()
class PluginBaseTests(unittest.TestCase):
    def setUp(self):
        self.aparser = argparse.ArgumentParser(
            prog='kafka-assigner',
            description='Rejigger Kafka cluster partitions')
        self.subparsers = self.aparser.add_subparsers(
            help='Select manipulation module to use')
        self.args = argparse.Namespace()

        self.cluster = Cluster()
        self.plugin = PluginModule()

    def test_plugin_create(self):
        assert isinstance(self.plugin, PluginModule)

    def test_plugin_set_default_arguments(self):
        self.plugin.set_default_arguments(self.aparser)

    def test_plugin_set_arguments(self):
        self.plugin.set_arguments(self.args)

    def test_plugin_set_cluster(self):
        self.plugin.set_cluster(self.cluster)

    def test_plugin_after_sizes(self):
        self.plugin.after_sizes()

    def test_plugin_set_new_cluster(self):
        self.plugin.set_new_cluster(self.cluster)

    def test_plugin_set_batches(self):
        self.plugin.set_batches([])

    def test_plugin_before_execute_batch(self):
        self.plugin.before_execute_batch(1)

    def test_plugin_after_execute_batch(self):
        self.plugin.after_execute_batch(1)

    def test_plugin_before_ple(self):
        self.plugin.before_ple()

    def test_plugin_finished(self):
        self.plugin.finished()