def test_create_topic(self): name = uuid.uuid4() topic = Topic(name=name, zookeeper_host="sandbox.hortonworks.com:2181") self.assertFalse(topic.is_exists()) Kafka.create_topic(name=name, replication_factor=1, partitions=1, zookeeper_host="sandbox.hortonworks.com:2181") self.assertTrue(topic.is_exists()) self.assertTrue(str(name) in topic.get_metadata()) topic.delete()
def test_delete_config(self): _command = "kafka-run-class.sh kafka.admin.TopicCommand --zookeeper localhost:2181 --topic Topic --alter deleteConfig kye1=value1" topic = Topic(name="Topic", zookeeper_host="localhost:2181", executor=mock_executor(expected_command=_command)) topic.delete_config(key="kye1", value="value1")
def test_get_metadta(self): _command = "kafka-run-class.sh kafka.admin.TopicCommand --zookeeper localhost:2181 --topic Topic --describe" topic = Topic(name="Topic", zookeeper_host="localhost:2181", executor=mock_executor(expected_command=_command)) topic.get_metadata()