Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(modules.kafka): Use broker container IP instead of host IP for advertised broker listener #1989

Merged
merged 10 commits into from May 8, 2024
7 changes: 6 additions & 1 deletion modules/kafka/kafka.go
Expand Up @@ -72,12 +72,17 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize
return err
}

ip, err := c.ContainerIP(ctx)
khartld marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return err
}

port, err := c.MappedPort(ctx, publicPort)
if err != nil {
return err
}

scriptContent := fmt.Sprintf(starterScriptContent, host, port.Int(), host)
scriptContent := fmt.Sprintf(starterScriptContent, host, port.Int(), ip)

return c.CopyToContainer(ctx, []byte(scriptContent), starterScript, 0o755)
},
Expand Down