-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[MO] - replace EmbeddedKafkaCluster with Strimzi test container #6337
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b78490b
[MO] - replace EmbeddedKafkaCluster with Strimzi test container (1/2)…
49989aa
[MO] - replace EmbeddedKafkaCluster with Strimzi test container (2/x)…
3153cd0
[MO] - replace EmbeddedKafkaCluster with Strimzi test container (3/3)…
410be03
get back config-model-generatoro
9aee417
remove todo
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import io.strimzi.operator.common.MicrometerMetricsProvider; | ||
import io.strimzi.operator.common.Reconciliation; | ||
import io.strimzi.operator.common.operator.resource.CrdOperator; | ||
import io.strimzi.test.container.StrimziKafkaCluster; | ||
import io.strimzi.test.mockkube.MockKube; | ||
import io.vertx.core.Future; | ||
import io.vertx.core.Vertx; | ||
|
@@ -29,7 +30,6 @@ | |
import io.vertx.junit5.VertxTestContext; | ||
import io.vertx.micrometer.MicrometerMetricsOptions; | ||
import io.vertx.micrometer.VertxPrometheusOptions; | ||
import org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster; | ||
import org.hamcrest.CoreMatchers; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.AfterEach; | ||
|
@@ -40,6 +40,7 @@ | |
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import java.util.concurrent.TimeUnit; | ||
|
@@ -55,7 +56,7 @@ | |
|
||
@ExtendWith(VertxExtension.class) | ||
public class KafkaConnectorIT { | ||
private static EmbeddedKafkaCluster cluster; | ||
private static StrimziKafkaCluster cluster; | ||
private static Vertx vertx; | ||
private ConnectCluster connectCluster; | ||
|
||
|
@@ -67,7 +68,9 @@ public static void before() throws IOException { | |
.setEnabled(true) | ||
)); | ||
|
||
cluster = new EmbeddedKafkaCluster(3); | ||
final Map<String, String> kafkaClusterConfiguration = new HashMap<>(); | ||
kafkaClusterConfiguration.put("zookeeper.connect", "zookeeper:2181"); | ||
cluster = new StrimziKafkaCluster(3, 1, kafkaClusterConfiguration); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, |
||
cluster.start(); | ||
} | ||
|
||
|
@@ -83,7 +86,7 @@ public void beforeEach() throws IOException, InterruptedException { | |
|
||
// Start a 3 node connect cluster | ||
connectCluster = new ConnectCluster() | ||
.usingBrokers(cluster.bootstrapServers()) | ||
.usingBrokers(cluster.getBootstrapServers()) | ||
.addConnectNodes(3); | ||
connectCluster.startup(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
import java.util.HashMap; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
|
@@ -24,11 +23,11 @@ | |
import io.fabric8.kubernetes.client.WatcherException; | ||
import io.strimzi.api.kafka.model.KafkaTopic; | ||
import io.strimzi.api.kafka.model.KafkaTopicBuilder; | ||
import io.strimzi.test.container.StrimziKafkaCluster; | ||
import kafka.server.KafkaConfig$; | ||
import org.apache.kafka.clients.admin.CreateTopicsResult; | ||
import org.apache.kafka.clients.admin.NewTopic; | ||
import org.apache.kafka.common.errors.InvalidRequestException; | ||
import org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.junit.jupiter.api.AfterAll; | ||
|
@@ -46,11 +45,11 @@ | |
|
||
public class TopicOperatorIT extends TopicOperatorBaseIT { | ||
private static final Logger LOGGER = LogManager.getLogger(TopicOperatorIT.class); | ||
protected static EmbeddedKafkaCluster kafkaCluster; | ||
protected static StrimziKafkaCluster kafkaCluster; | ||
|
||
@BeforeAll | ||
public static void beforeAll() throws IOException { | ||
kafkaCluster = new EmbeddedKafkaCluster(numKafkaBrokers(), kafkaClusterConfig()); | ||
kafkaCluster = new StrimziKafkaCluster(numKafkaBrokers(), numKafkaBrokers(), kafkaClusterConfig()); | ||
kafkaCluster.start(); | ||
|
||
setupKubeCluster(); | ||
|
@@ -76,9 +75,10 @@ protected static int numKafkaBrokers() { | |
return 1; | ||
} | ||
|
||
protected static Properties kafkaClusterConfig() { | ||
Properties p = new Properties(); | ||
p.setProperty(KafkaConfig$.MODULE$.AutoCreateTopicsEnableProp(), "false"); | ||
protected static Map<String, String> kafkaClusterConfig() { | ||
Map<String, String> p = new HashMap<>(); | ||
p.put(KafkaConfig$.MODULE$.AutoCreateTopicsEnableProp(), "false"); | ||
p.put("zookeeper.connect", "zookeeper:2181"); | ||
Comment on lines
+79
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return p; | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use
Map.of
to make this a 1 liner?