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_create_topic(self): _command = "kafka-run-class.sh kafka.admin.TopicCommand --create --zookeeper master1.mycluster:2181" \ " --topic Topic --partitions 3 --replication-factor 1" Kafka.create_topic(name='Topic', replication_factor=1, partitions=3, zookeeper_host="master1.mycluster:2181", executor=mock_executor(expected_command=_command))