mimaison commented on a change in pull request #10221:
URL: https://github.com/apache/kafka/pull/10221#discussion_r658821310
##########
File path:
connect/mirror/src/test/java/org/apache/kafka/connect/mirror/MirrorConnectorConfigTest.java
##########
@@ -262,4 +264,65 @@ public void testTargetAdminConfigWithSourcePrefix() {
assertEquals(expectedAdminProps, connectorAdminProps, prefix + "
source connector admin props not matching");
}
+ @Test
+ public void testOffsetSyncsTopic() {
+ // Invalid location
+ Map<String, String> connectorProps =
makeProps("offset-syncs.topic.location", "something");
+ assertThrows(ConfigException.class, () -> new
MirrorConnectorConfig(connectorProps));
+
+ connectorProps.put("offset-syncs.topic.location", "source");
+ MirrorConnectorConfig config = new
MirrorConnectorConfig(connectorProps);
+ assertEquals("mm2-offset-syncs.target2.internal",
config.offsetSyncsTopic());
+ connectorProps.put("offset-syncs.topic.location", "target");
+ config = new MirrorConnectorConfig(connectorProps);
+ assertEquals("mm2-offset-syncs.source1.internal",
config.offsetSyncsTopic());
+ // Default to source
+ connectorProps.remove("offset-syncs.topic.location");
+ config = new MirrorConnectorConfig(connectorProps);
+ assertEquals("mm2-offset-syncs.target2.internal",
config.offsetSyncsTopic());
+ }
+
+ @Test
+ public void testConsumerConfigsForOffsetSyncsTopic() {
+ Map<String, String> connectorProps = makeProps(
+ "source.consumer.max.partition.fetch.bytes", "1",
+ "target.consumer.heartbeat.interval.ms", "1",
+ "consumer.max.poll.interval.ms", "1",
+ "fetch.min.bytes", "1"
+ );
+ MirrorConnectorConfig config = new
MirrorConnectorConfig(connectorProps);
+ assertEquals(config.sourceConsumerConfig(),
config.offsetSyncsTopicConsumerConfig());
+ connectorProps.put("offset-syncs.topic.location", "target");
+ config = new MirrorConnectorConfig(connectorProps);
+ assertEquals(config.targetConsumerConfig(),
config.offsetSyncsTopicConsumerConfig());
+ }
+
+ @Test
+ public void testProducerConfigsForOffsetSyncsTopic() {
+ Map<String, String> connectorProps = makeProps(
+ "source.batch.size", "1",
+ "target.acks", "1",
+ "producer.max.poll.interval.ms", "1",
+ "fetch.min.bytes", "1"
+ );
+ MirrorConnectorConfig config = new
MirrorConnectorConfig(connectorProps);
+ assertEquals(config.sourceProducerConfig(),
config.offsetSyncsTopicProducerConfig());
+ connectorProps.put("offset-syncs.topic.location", "target");
Review comment:
Right, I should have seen that this morning when I updated the test just
above! Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]