Skip to content

How to create a Kafka test Container #121

Closed

Description

@wuqunfei

Could we create a Kafka container like this
with TestContainer(image="confluentinc/cp-kafka:5.4.3") as container: ip = container.get_container_host_ip()

but I don't know how to implement a method like https://www.testcontainers.org/modules/kafka/
kafka.getBootstrapServers()

Activity

  1. ash1425 commented on Jan 5, 2021

    @ash1425
    Contributor

    Kafka container from confluent needs some more configurations before it can be started. I am working on a PR for kafka container. Meanwhile you can look at sample implementation at https://github.com/SrinivasanTarget/python_flask_app/blob/main/test/kafka.py.
    This sample and my PR is highly inspired by Kafka testcontainer module in java.

  2. manojhans commented on Feb 17, 2021

    @manojhans

    @wuqunfei you can create kafka container using DockerCompose with specific port, here is the example: https://github.com/manojhans/python_testcontainers_kafka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions