You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/12/01 16:42:37 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #13112: [BEAM-11065] Apache Beam Template to ingest from Apache Kafka to Google Pub/Sub

TheNeuralBit commented on a change in pull request #13112:
URL: https://github.com/apache/beam/pull/13112#discussion_r533559375



##########
File path: examples/templates/java/kafka-to-pubsub/src/test/java/org/apache/beam/templates/KafkaToPubsubTest.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.beam.templates;
+
+import static org.apache.beam.templates.KafkaPubsubConstants.PASSWORD;
+import static org.apache.beam.templates.KafkaPubsubConstants.USERNAME;
+import static org.apache.beam.templates.kafka.consumer.Utils.getKafkaCredentialsFromVault;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.beam.templates.kafka.consumer.Utils;
+import org.apache.kafka.common.config.SaslConfigs;
+import org.apache.kafka.common.security.scram.ScramMechanism;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Test of KafkaToPubsub. */
+@RunWith(JUnit4.class)
+public class KafkaToPubsubTest {

Review comment:
       You might take a look at how our tests for PubsubIO and KafkaIO work as they have to contend with this same problem.
   
   For KafkaIO, we use [testcontainers](https://github.com/apache/beam/blob/02da3ae62e9025ff093747bb7a098982d34eff1b/sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaIOIT.java#L336) to stand up a fake Kafka service to test against.
   
   For E2E tests of PubsubIO and other GCP-specific features we have the apache-beam-testing project. We could probably give you access to this. Alternatively, there is now a [PubSub emulator](https://cloud.google.com/pubsub/docs/emulator) that you could use to stand up a fake PubSub service, just like the Kafka testcontainer. I don't think there are any examples using it in Beam yet though.




----------------------------------------------------------------
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:
users@infra.apache.org