Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
import static org.apache.kafka.connect.source.SourceTask.TransactionBoundary.CONNECTOR;
import static org.apache.kafka.connect.source.SourceTask.TransactionBoundary.INTERVAL;
import static org.apache.kafka.connect.source.SourceTask.TransactionBoundary.POLL;
import static org.apache.kafka.test.TestUtils.waitForCondition;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -750,9 +751,18 @@ public void testSeparateOffsetsTopic() throws Exception {
workerProps.put(DistributedConfig.OFFSET_STORAGE_TOPIC_CONFIG, globalOffsetsTopic);

startConnect();
EmbeddedKafkaCluster connectorTargetedCluster = new EmbeddedKafkaCluster(1, brokerProps);

int numConnectorTargetedBrokers = 1;
EmbeddedKafkaCluster connectorTargetedCluster = new EmbeddedKafkaCluster(numConnectorTargetedBrokers, brokerProps);
try (Closeable clusterShutdown = connectorTargetedCluster::stop) {
connectorTargetedCluster.start();
// Wait for the connector-targeted Kafka cluster to get on its feet
waitForCondition(
() -> connectorTargetedCluster.runningBrokers().size() == numConnectorTargetedBrokers,
ConnectAssertions.WORKER_SETUP_DURATION_MS,
"Separate Kafka cluster did not start in time"
);

String topic = "test-topic";
connectorTargetedCluster.createTopic(topic, 3);

Expand Down Expand Up @@ -780,6 +790,11 @@ public void testSeparateOffsetsTopic() throws Exception {

// start a source connector
connect.configureConnector(CONNECTOR_NAME, props);
connect.assertions().assertConnectorAndExactlyNumTasksAreRunning(
CONNECTOR_NAME,
numTasks,
"connector and tasks did not start in time"
);

log.info("Waiting for records to be provided to worker by task");
// wait for the connector tasks to produce enough records
Expand Down