ivanyu commented on code in PR #6934:
URL: https://github.com/apache/kafka/pull/6934#discussion_r1595365475
##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectWorkerIntegrationTest.java:
##########
@@ -773,6 +773,41 @@ public void
testDeleteConnectorCreatedWithPausedOrStoppedInitialState() throws E
connect.assertions().assertConnectorDoesNotExist(CONNECTOR_NAME,
"Connector wasn't deleted in time");
}
+ @Test
+ public void testPatchConnectorConfig() throws Exception {
+ connect = connectBuilder.build();
+ // start the clusters
+ connect.start();
+
+ connect.assertions().assertAtLeastNumWorkersAreUp(NUM_WORKERS,
+ "Initial group of workers did not start in time.");
+
+ connect.kafka().createTopic(TOPIC_NAME);
+
+ Map<String, String> props = defaultSinkConnectorProps(TOPIC_NAME);
+ props.put("unaffected-key", "unaffected-value");
+ props.put("to-be-deleted-key", "value");
+ props.put(TASKS_MAX_CONFIG, "1");
+
+ Map<String, String> patch = new HashMap<>();
+ patch.put(TASKS_MAX_CONFIG, "2"); // this plays as a value to be
changed
+ patch.put("to-be-added-key", "value");
+ patch.put("to-be-deleted-key", null);
+
+ connect.configureConnector(CONNECTOR_NAME, props);
+ connect.patchConnectorConfig(CONNECTOR_NAME, patch);
+
+
connect.assertions().assertConnectorAndExactlyNumTasksAreRunning(CONNECTOR_NAME,
2,
+ "connector and tasks did not start in time");
+
+ Map<String, String> expectedConfig = new HashMap<>(props);
+ expectedConfig.put("name", CONNECTOR_NAME);
+ expectedConfig.put("to-be-added-key", "value");
+ expectedConfig.put(TASKS_MAX_CONFIG, "2");
+ expectedConfig.remove("to-be-deleted-key");
+ assertEquals(expectedConfig,
connect.connectorInfo(CONNECTOR_NAME).config());
Review Comment:
Thanks, great suggestion. Done
--
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]