pabloem commented on code in PR #17565:
URL: https://github.com/apache/beam/pull/17565#discussion_r867234398


##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaCommitOffsetTest.java:
##########
@@ -67,18 +73,50 @@ public Consumer<byte[], byte[]> apply(Map<String, Object> 
input) {
     Assert.assertEquals(2L, consumer.commit.get(partition).offset());
   }
 
+  @Test
+  public void testCommitOffsetError() {
+    Map<String, Object> configMap = new HashMap<>();
+    configMap.put(ConsumerConfig.GROUP_ID_CONFIG, "group1");
+
+    ReadSourceDescriptors<Object, Object> descriptors =
+        ReadSourceDescriptors.read()
+            .withBootstrapServers("bootstrap_server")
+            .withConsumerConfigUpdates(configMap)
+            .withConsumerFactoryFn(
+                new SerializableFunction<Map<String, Object>, Consumer<byte[], 
byte[]>>() {
+                  @Override
+                  public Consumer<byte[], byte[]> apply(Map<String, Object> 
input) {
+                    Assert.assertEquals("group1", 
input.get(ConsumerConfig.GROUP_ID_CONFIG));
+                    return errorConsumer;
+                  }
+                });
+    CommitOffsetDoFn doFn = new CommitOffsetDoFn(descriptors);
+
+    doFn.processElement(
+        KV.of(KafkaSourceDescriptor.of(partition, null, null, null, null, 
null), 1L));

Review Comment:
   what does this test do? first throw a failure and then succeed? should the 
doFn throw the exception? How do we know that the exception is not being 
swallowed and the offset commit is eventually making it in?



-- 
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]

Reply via email to