testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

feat(kafka): additional advertised listeners/broker addresses for kafka

Open ghthor opened this issue 10 months ago • 12 comments

What does this PR do?

  1. Add additional kafka listeners to support more networking configurations
  2. Add additional kafka advertised listeners for the above
  3. Add new methods for retrieving brokers based on different hostnames

Why is it important?

  1. kafka likes to know the exact address where it can be reached
  2. the current ad. listeners returns localhost:<random port>
  3. localhost is not a valid address to kafka when running within another docker container

This change is intended to support more complicated testing setups where the test code is running itself is another docker container, thus needs kafka to advertise a connection string other than localhost.

Related issues

  1. Alternate implementation to https://github.com/testcontainers/testcontainers-go/pull/2894
  2. supersedes #2490

How to test this PR

  1. Unit tests adding in PR
  2. Examples added in PR

ghthor avatar Dec 15 '24 14:12 ghthor