vamossagar12 commented on code in PR #14372:
URL: https://github.com/apache/kafka/pull/14372#discussion_r1670184984


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTest.java:
##########
@@ -2156,6 +2157,42 @@ public void testAlterOffsetsSourceConnector(boolean 
enableTopicCreation) throws
         verifyKafkaClusterId();
     }
 
+    @ParameterizedTest
+    @ValueSource(booleans = {true, false})
+    public void testGetSourceConnectorOffsetsFetchError(boolean 
enableTopicCreation) {
+        setup(enableTopicCreation);
+        mockKafkaClusterId();
+
+        ConnectorOffsetBackingStore offsetStore = 
mock(ConnectorOffsetBackingStore.class);
+        CloseableOffsetStorageReader offsetReader = 
mock(CloseableOffsetStorageReader.class);
+
+        Set<Map<String, Object>> connectorPartitions =
+            Collections.singleton(Collections.singletonMap("partitionKey", 
"partitionValue"));
+
+        
when(executorService.submit(any(Runnable.class))).thenAnswer(invocation -> {
+            invocation.getArgument(0, Runnable.class).run();
+            return null;
+        });
+        worker = new Worker(WORKER_ID, new MockTime(), plugins, config, 
offsetBackingStore, executorService,
+            allConnectorClientConfigOverridePolicy, null);
+        worker.start();
+
+        
when(offsetStore.connectorPartitions(CONNECTOR_ID)).thenReturn(connectorPartitions);
+        doAnswer(invocation -> {
+            throw new ExecutionException(new 
SaslAuthenticationException("error"));
+        }).when(offsetReader).offsets(connectorPartitions);

Review Comment:
   yeah, you are right. Actually I just realised, this test is redundant 
because it is not actually testing anything wrt the failure of WorkThread in 
KafkaBasedLog. We already have a similar test `testGetSourceConnectorOffsets` 
which does whatever you described above. I have removed this test.



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