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


##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaIOTest.java:
##########
@@ -1233,6 +1240,31 @@ public void testUnboundedSourceMetrics() {
         commitsEnqueuedMetrics.getCounters().iterator().next().getAttempted(), 
greaterThan(0L));
   }
 
+  @Test
+  public void testUnboundedReaderLogsCommitFailure() throws Exception {
+
+    List<String> topics = ImmutableList.of("topic_a");
+
+    PositionErrorConsumerFactory positionErrorConsumerFactory = new 
PositionErrorConsumerFactory();
+
+    UnboundedSource<KafkaRecord<Integer, Long>, KafkaCheckpointMark> source =
+        KafkaIO.<Integer, Long>read()
+            .withBootstrapServers("myServer1:9092,myServer2:9092")
+            .withTopics(topics)
+            .withConsumerFactoryFn(positionErrorConsumerFactory)
+            .withKeyDeserializer(IntegerDeserializer.class)
+            .withValueDeserializer(LongDeserializer.class)
+            .makeSource();
+
+    UnboundedReader<KafkaRecord<Integer, Long>> reader = 
source.createReader(null, null);
+
+    reader.start();
+
+    unboundedReaderExpectedLogs.verifyWarn("exception while fetching latest 
offset for partition");
+
+    reader.close();

Review Comment:
   Similar to above comment, the offsets here are committed periodically, 
although this period is configured to be 1 second instead of 5 mintues. This 
test is to verify that the exception block is executed as expected



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