Repository navigation
Respect user-defined security protocol for additional Kafka listeners - #12108
SamuelAdigos wants to merge 1 commit into
Conversation
`KafkaHelper` always appended `TC-<n>:PLAINTEXT` to `KAFKA_LISTENER_SECURITY_PROTOCOL_MAP` for listeners registered via `withListener(...)`, even when the user had already mapped that listener (e.g. `TC-0:SASL_PLAINTEXT`). Kafka then used `PLAINTEXT`, so additional listeners could not be secured. The default mapping is now only added when no mapping exists for the listener, matched case-insensitively as Kafka normalises listener names. Fixes testcontainers#10035
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Additional Kafka listeners now keep the security protocol the user configured, and the default is unchanged when none is set. No merge-blocking risk was found. Pre-merge checks |
|
Fixes #10035
When a listener is registered via
withListener(...),KafkaHelperalways appendedTC-<n>:PLAINTEXTtoKAFKA_LISTENER_SECURITY_PROTOCOL_MAP, even if the user had already mapped that listener (e.g.TC-0:SASL_PLAINTEXT).The map then contained the listener twice and Kafka used
PLAINTEXT, so additional listeners could not be securedwithout overriding
configure().The default
TC-<n>:PLAINTEXTmapping is now only added when the user has not configured one for that listener(matched case-insensitively, as Kafka normalises listener names). Default behaviour is unchanged.
This applies to both
org.testcontainers.kafka.KafkaContainerandConfluentKafkaContainer; the deprecatedorg.testcontainers.containers.KafkaContaineris left untouched.Tests
ConfluentKafkaContainerTest.shouldKeepSecurityProtocolConfiguredForListener: mapsTC-0toSASL_PLAINTEXTand produces/consumes through that listener with SASL/PLAIN (fails before the fix).
./gradlew :testcontainers-kafka:checkplus spotless/checkstyle/japicmp.testMatrixlocally; remaining failures are environment-related (arm64 host, Rancher Desktop)and reproduce on
main.Summary by CodeRabbit