arpadboda commented on a change in pull request #697: MINIFICPP-1104 - SSL
docker tests for PublishKafka
URL: https://github.com/apache/nifi-minifi-cpp/pull/697#discussion_r358221199
##########
File path: docker/test/integration/minifi/__init__.py
##########
@@ -214,31 +205,47 @@ def deploy_nifi_flow(self, flow, name, vols):
self.containers[container.name] = container
def deploy_kafka_broker(self, name):
- dockerfile = dedent("""FROM {base_image}
- USER root
- CMD $KAFKA_HOME/bin/kafka-console-consumer.sh
--bootstrap-server host.docker.internal:9092 --topic test > heaven_signal.txt
- """.format(base_image='spotify/kafka:latest'))
-
- logging.info('Creating and running docker container for kafka
broker...')
+ logging.info('Creating and running docker containers for kafka
broker...')
+ # TODO: The line below expects we run ./DockerVerify.sh <version> for
testing
+ broker_image =
self.build_image_by_path("docker/test/integration/resources/kafka_broker",
'minifi-kafka')
broker = self.client.containers.run(
- self.client.images.pull("spotify/kafka:latest"),
+ broker_image[0],
detach=True,
name='kafka-broker',
- ports={'2181/tcp': 2181, '9092/tcp': 9092},
- environment=["ADVERTISED_HOST=192.168.42.4",
"ADVERTISED_PORT=9092"]
+ network=self.network.name,
+
environment=["ADVERTISED_LISTENERS=PLAINTEXT://kafka-broker:9092,SSL://kafka-broker:9093"]
)
- self.network.connect(broker, ipv4_address='192.168.42.4')
+ # PLAINTEXT
+ plain_consumer_file = dedent("""FROM {base_image}
+ USER root
+ CMD $KAFKA_HOME/bin/kafka-console-consumer.sh
--bootstrap-server kafka-broker:9092 --topic test > heaven_signal.txt
+ """.format(base_image='minifi-kafka'))
- configured_image = self.build_image(dockerfile, [])
- consumer = self.client.containers.run(
- configured_image[0],
+ plain_image = self.build_image(plain_consumer_file, [])
+ plain_consumer = self.client.containers.run(
+ plain_image[0],
detach=True,
- name='kafka-consumer',
+ name='plain-consumer',
network=self.network.name
)
-
- self.containers[consumer.name] = consumer
+ # SSL
+ ssl_consumer_file = dedent("""FROM {base_image}
+ USER root
+ CMD $KAFKA_HOME/bin/kafka-console-consumer.sh
--bootstrap-server kafka-broker:9093 --topic test \
Review comment:
I think the port and the additional config for the SSL case could be
placeholders in this string as well, so you don't need to duplicate the whole
stuff, just use different args in format in the two cases.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services