[GitHub] [kafka] rhauch commented on a change in pull request #8654: KAFKA-9931: Implement KIP-605 to expand support for Connect worker internal topic configurations

2020-05-20 Thread GitBox


rhauch commented on a change in pull request #8654:
URL: https://github.com/apache/kafka/pull/8654#discussion_r428333268



##
File path: 
connect/runtime/src/test/java/org/apache/kafka/connect/integration/InternalTopicsIntegrationTest.java
##
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.connect.integration;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.kafka.connect.runtime.distributed.DistributedConfig;
+import org.apache.kafka.connect.util.clusters.EmbeddedConnectCluster;
+import org.apache.kafka.test.IntegrationTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Integration test for the creation of internal topics.
+ */
+@Category(IntegrationTest.class)
+public class InternalTopicsIntegrationTest {
+
+private static final Logger log = 
LoggerFactory.getLogger(InternalTopicsIntegrationTest.class);
+
+private EmbeddedConnectCluster.Builder connectBuilder;
+private EmbeddedConnectCluster connect;
+Map workerProps = new HashMap<>();
+Properties brokerProps = new Properties();
+
+@Before
+public void setup() {
+// setup Kafka broker properties
+brokerProps.put("auto.create.topics.enable", String.valueOf(false));
+
+// build a Connect cluster backed by Kafka and Zk
+connectBuilder = new EmbeddedConnectCluster.Builder()
+.name("connect-cluster")
+.numWorkers(1)
+.numBrokers(1)
+.brokerProps(brokerProps);
+}
+
+@After
+public void close() {
+// stop all Connect, Kafka and Zk threads.
+connect.stop();
+}
+
+@Test
+public void testCreateInternalTopicsWithDefaultSettings() throws 
InterruptedException {
+int numWorkers = 1;
+int numBrokers = 3;
+connect = new 
EmbeddedConnectCluster.Builder().name("connect-cluster-1")

Review comment:
   I was running into other issues, and I never changed it. The names are 
not important, so I'll change them back to the same cluster name.
   
   I actually do prefer how each test fully sets up the cluster builder, in 
part because some of the information is changed and some isn't. I found it very 
error prone while I was working on this to reuse a builder and have each test 
only change *some* of the attributes, or to remember to set the worker props 
after changing the `workerProps` map.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [kafka] rhauch commented on a change in pull request #8654: KAFKA-9931: Implement KIP-605 to expand support for Connect worker internal topic configurations

2020-05-20 Thread GitBox


rhauch commented on a change in pull request #8654:
URL: https://github.com/apache/kafka/pull/8654#discussion_r428334196



##
File path: 
connect/runtime/src/test/java/org/apache/kafka/connect/integration/InternalTopicsIntegrationTest.java
##
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.connect.integration;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.kafka.connect.runtime.distributed.DistributedConfig;
+import org.apache.kafka.connect.util.clusters.EmbeddedConnectCluster;
+import org.apache.kafka.test.IntegrationTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Integration test for the creation of internal topics.
+ */
+@Category(IntegrationTest.class)
+public class InternalTopicsIntegrationTest {
+
+private static final Logger log = 
LoggerFactory.getLogger(InternalTopicsIntegrationTest.class);
+
+private EmbeddedConnectCluster.Builder connectBuilder;
+private EmbeddedConnectCluster connect;
+Map workerProps = new HashMap<>();
+Properties brokerProps = new Properties();
+
+@Before
+public void setup() {
+// setup Kafka broker properties
+brokerProps.put("auto.create.topics.enable", String.valueOf(false));
+
+// build a Connect cluster backed by Kafka and Zk
+connectBuilder = new EmbeddedConnectCluster.Builder()
+.name("connect-cluster")
+.numWorkers(1)
+.numBrokers(1)
+.brokerProps(brokerProps);
+}
+
+@After
+public void close() {
+// stop all Connect, Kafka and Zk threads.
+connect.stop();
+}
+
+@Test
+public void testCreateInternalTopicsWithDefaultSettings() throws 
InterruptedException {
+int numWorkers = 1;
+int numBrokers = 3;
+connect = new 
EmbeddedConnectCluster.Builder().name("connect-cluster-1")
+  .workerProps(workerProps)
+  .numWorkers(numWorkers)
+  .numBrokers(numBrokers)
+  .brokerProps(brokerProps)
+  .build();
+
+// Start the Connect cluster
+connect.start();
+connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Brokers 
did not start in time.");
+connect.assertions().assertExactlyNumWorkersAreUp(numWorkers, "Worker 
did not start in time.");
+log.info("Completed startup of {} Kafka brokers and {} Connect 
workers", numBrokers, numWorkers);
+
+// Check the topics
+log.info("Verifying the internal topics for Connect");
+connect.assertions().assertTopicsExist(configTopic(), offsetTopic(), 
statusTopic());
+assertInternalTopicSettings();
+
+// Remove the Connect worker
+log.info("Stopping the Connect worker");
+connect.removeWorker();
+
+// Sleep for a bit
+Thread.sleep(3000);

Review comment:
   Good catch. I had put this in while debugging an issue, but it is not 
needed.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [kafka] rhauch commented on a change in pull request #8654: KAFKA-9931: Implement KIP-605 to expand support for Connect worker internal topic configurations

2020-05-20 Thread GitBox


rhauch commented on a change in pull request #8654:
URL: https://github.com/apache/kafka/pull/8654#discussion_r428333268



##
File path: 
connect/runtime/src/test/java/org/apache/kafka/connect/integration/InternalTopicsIntegrationTest.java
##
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.connect.integration;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.kafka.connect.runtime.distributed.DistributedConfig;
+import org.apache.kafka.connect.util.clusters.EmbeddedConnectCluster;
+import org.apache.kafka.test.IntegrationTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Integration test for the creation of internal topics.
+ */
+@Category(IntegrationTest.class)
+public class InternalTopicsIntegrationTest {
+
+private static final Logger log = 
LoggerFactory.getLogger(InternalTopicsIntegrationTest.class);
+
+private EmbeddedConnectCluster.Builder connectBuilder;
+private EmbeddedConnectCluster connect;
+Map workerProps = new HashMap<>();
+Properties brokerProps = new Properties();
+
+@Before
+public void setup() {
+// setup Kafka broker properties
+brokerProps.put("auto.create.topics.enable", String.valueOf(false));
+
+// build a Connect cluster backed by Kafka and Zk
+connectBuilder = new EmbeddedConnectCluster.Builder()
+.name("connect-cluster")
+.numWorkers(1)
+.numBrokers(1)
+.brokerProps(brokerProps);
+}
+
+@After
+public void close() {
+// stop all Connect, Kafka and Zk threads.
+connect.stop();
+}
+
+@Test
+public void testCreateInternalTopicsWithDefaultSettings() throws 
InterruptedException {
+int numWorkers = 1;
+int numBrokers = 3;
+connect = new 
EmbeddedConnectCluster.Builder().name("connect-cluster-1")

Review comment:
   I was running into other issues, and I never changed it. I actually 
prefer how each test fully sets up the cluster builder, but the names should 
not be important.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org