11package org .testcontainers .containers ;
22
3- import static java .util .Collections .singletonList ;
4- import static org .assertj .core .api .Assertions .assertThat ;
5- import static org .assertj .core .api .Assertions .tuple ;
6-
73import com .google .common .collect .ImmutableMap ;
8- import java .time .Duration ;
9- import java .util .Collection ;
10- import java .util .UUID ;
11- import java .util .concurrent .TimeUnit ;
124import org .apache .kafka .clients .admin .AdminClient ;
135import org .apache .kafka .clients .admin .AdminClientConfig ;
146import org .apache .kafka .clients .admin .NewTopic ;
2113import org .apache .kafka .clients .producer .ProducerRecord ;
2214import org .apache .kafka .common .serialization .StringDeserializer ;
2315import org .apache .kafka .common .serialization .StringSerializer ;
24- import org .junit .ClassRule ;
2516import org .junit .Test ;
2617import org .rnorth .ducttape .unreliables .Unreliables ;
2718import org .testcontainers .Testcontainers ;
2819import org .testcontainers .utility .DockerImageName ;
2920
21+ import java .time .Duration ;
22+ import java .util .Collection ;
23+ import java .util .UUID ;
24+ import java .util .concurrent .TimeUnit ;
25+
26+ import static java .util .Collections .singletonList ;
27+ import static org .assertj .core .api .Assertions .assertThat ;
28+ import static org .assertj .core .api .Assertions .tuple ;
29+
3030public class KafkaContainerTest {
3131
32- private static final DockerImageName KAFKA_TEST_IMAGE = DockerImageName .parse ("confluentinc/cp-kafka:5.4.3 " );
32+ private static final DockerImageName KAFKA_TEST_IMAGE = DockerImageName .parse ("confluentinc/cp-kafka:6.2.1 " );
3333 private static final DockerImageName ZOOKEEPER_TEST_IMAGE = DockerImageName .parse ("confluentinc/cp-zookeeper:4.0.0" );
3434
35- // junitRule {
36- @ ClassRule
37- public static KafkaContainer kafka = new KafkaContainer (DockerImageName .parse ("confluentinc/cp-kafka:5.4.3" ));
38- // }
39-
4035 @ Test
4136 public void testUsage () throws Exception {
4237 try (KafkaContainer kafka = new KafkaContainer (KAFKA_TEST_IMAGE )) {
@@ -50,7 +45,7 @@ public void testUsage() throws Exception {
5045 public void testUsageWithSpecificImage () throws Exception {
5146 try (
5247 // constructorWithVersion {
53- KafkaContainer kafka = new KafkaContainer (DockerImageName .parse ("confluentinc/cp-kafka:5.4.3 " ))
48+ KafkaContainer kafka = new KafkaContainer (DockerImageName .parse ("confluentinc/cp-kafka:6.2.1 " ))
5449 // }
5550 ) {
5651 kafka .start ();
@@ -62,11 +57,10 @@ public void testUsageWithSpecificImage() throws Exception {
6257 }
6358 }
6459
65-
6660 @ Test
6761 public void testUsageWithVersion () throws Exception {
6862 try (
69- KafkaContainer kafka = new KafkaContainer ("5.5 .1" )
63+ KafkaContainer kafka = new KafkaContainer ("6.2 .1" )
7064 ) {
7165 kafka .start ();
7266 testKafkaFunctionality (kafka .getBootstrapServers ());
@@ -105,9 +99,9 @@ public void testExternalZookeeperWithExternalNetwork() throws Exception {
10599 }
106100
107101 @ Test
108- public void testConfluentPlatformVersion6 () throws Exception {
102+ public void testConfluentPlatformVersion5 () throws Exception {
109103 try (
110- KafkaContainer kafka = new KafkaContainer (DockerImageName .parse ("confluentinc/cp-kafka:6.0.0 " ))
104+ KafkaContainer kafka = new KafkaContainer (DockerImageName .parse ("confluentinc/cp-kafka:5.4.3 " ))
111105 ) {
112106 kafka .start ();
113107 testKafkaFunctionality (kafka .getBootstrapServers ());
0 commit comments