@@ -9,7 +9,7 @@ const IMAGE = "confluentinc/cp-kafka:7.9.1";
99describe ( "KafkaContainer" , { timeout : 240_000 } , ( ) => {
1010 // connectBuiltInZK {
1111 it ( "should connect using in-built zoo-keeper" , async ( ) => {
12- const kafkaContainer = await new KafkaContainer ( IMAGE ) . withExposedPorts ( 9093 ) . start ( ) ;
12+ const kafkaContainer = await new KafkaContainer ( IMAGE ) . start ( ) ;
1313
1414 await testPubSub ( kafkaContainer ) ;
1515
@@ -18,7 +18,7 @@ describe("KafkaContainer", { timeout: 240_000 }, () => {
1818 // }
1919
2020 it ( "should connect using in-built zoo-keeper and custom images" , async ( ) => {
21- const kafkaContainer = await new KafkaContainer ( IMAGE ) . withExposedPorts ( 9093 ) . start ( ) ;
21+ const kafkaContainer = await new KafkaContainer ( IMAGE ) . start ( ) ;
2222
2323 await testPubSub ( kafkaContainer ) ;
2424
@@ -28,7 +28,7 @@ describe("KafkaContainer", { timeout: 240_000 }, () => {
2828 it ( "should connect using in-built zoo-keeper and custom network" , async ( ) => {
2929 const network = await new Network ( ) . start ( ) ;
3030
31- const kafkaContainer = await new KafkaContainer ( IMAGE ) . withNetwork ( network ) . withExposedPorts ( 9093 ) . start ( ) ;
31+ const kafkaContainer = await new KafkaContainer ( IMAGE ) . withNetwork ( network ) . start ( ) ;
3232
3333 await testPubSub ( kafkaContainer ) ;
3434
@@ -52,7 +52,6 @@ describe("KafkaContainer", { timeout: 240_000 }, () => {
5252 const kafkaContainer = await new KafkaContainer ( IMAGE )
5353 . withNetwork ( network )
5454 . withZooKeeper ( zooKeeperHost , zooKeeperPort )
55- . withExposedPorts ( 9093 )
5655 . start ( ) ;
5756
5857 await testPubSub ( kafkaContainer ) ;
@@ -191,7 +190,7 @@ describe("KafkaContainer", { timeout: 240_000 }, () => {
191190
192191 // connectKraft {
193192 it ( "should connect using kraft" , async ( ) => {
194- const kafkaContainer = await new KafkaContainer ( IMAGE ) . withKraft ( ) . withExposedPorts ( 9093 ) . start ( ) ;
193+ const kafkaContainer = await new KafkaContainer ( IMAGE ) . withKraft ( ) . start ( ) ;
195194
196195 await testPubSub ( kafkaContainer ) ;
197196
@@ -207,11 +206,7 @@ describe("KafkaContainer", { timeout: 240_000 }, () => {
207206
208207 it ( "should connect using kraft and custom network" , async ( ) => {
209208 const network = await new Network ( ) . start ( ) ;
210- const kafkaContainer = await new KafkaContainer ( IMAGE )
211- . withKraft ( )
212- . withNetwork ( network )
213- . withExposedPorts ( 9093 )
214- . start ( ) ;
209+ const kafkaContainer = await new KafkaContainer ( IMAGE ) . withKraft ( ) . withNetwork ( network ) . start ( ) ;
215210
216211 await testPubSub ( kafkaContainer ) ;
217212
@@ -220,27 +215,24 @@ describe("KafkaContainer", { timeout: 240_000 }, () => {
220215 } ) ;
221216
222217 it ( "should throw an error when using kraft wit sasl and confluence platfom below 7.5.0" , async ( ) => {
223- const kafkaContainer = new KafkaContainer ( "confluentinc/cp-kafka:7.4.0" )
224- . withKraft ( )
225- . withExposedPorts ( 9093 )
226- . withSaslSslListener ( {
227- port : 9094 ,
228- sasl : {
229- mechanism : "SCRAM-SHA-512" ,
230- user : {
231- name : "app-user" ,
232- password : "userPassword" ,
233- } ,
234- } ,
235- keystore : {
236- content : "fake" ,
237- passphrase : "serverKeystorePassword" ,
238- } ,
239- truststore : {
240- content : "fake" ,
241- passphrase : "serverTruststorePassword" ,
218+ const kafkaContainer = new KafkaContainer ( "confluentinc/cp-kafka:7.4.0" ) . withKraft ( ) . withSaslSslListener ( {
219+ port : 9094 ,
220+ sasl : {
221+ mechanism : "SCRAM-SHA-512" ,
222+ user : {
223+ name : "app-user" ,
224+ password : "userPassword" ,
242225 } ,
243- } ) ;
226+ } ,
227+ keystore : {
228+ content : "fake" ,
229+ passphrase : "serverKeystorePassword" ,
230+ } ,
231+ truststore : {
232+ content : "fake" ,
233+ passphrase : "serverTruststorePassword" ,
234+ } ,
235+ } ) ;
244236 await expect ( ( ) => kafkaContainer . start ( ) ) . rejects . toThrow (
245237 "Provided Confluent Platform's version 7.4.0 is not supported in Kraft mode with sasl (must be 7.5.0 or above)"
246238 ) ;
0 commit comments