mdedetrich commented on code in PR #12728: URL: https://github.com/apache/kafka/pull/12728#discussion_r990649200
########## connect/runtime/src/test/java/org/apache/kafka/connect/runtime/standalone/StandaloneHerderTest.java: ########## @@ -356,31 +350,26 @@ public void testRestartConnectorNewTaskConfigs() throws Exception { FutureCallback<Void> restartCallback = new FutureCallback<>(); herder.restartConnector(CONNECTOR_NAME, restartCallback); restartCallback.get(1000L, TimeUnit.MILLISECONDS); - - PowerMock.verifyAll(); } @Test public void testRestartConnectorFailureOnStart() throws Exception { expectAdd(SourceSink.SOURCE); Map<String, String> config = connectorConfig(SourceSink.SOURCE); - Connector connectorMock = PowerMock.createMock(SourceConnector.class); + Connector connectorMock = mock(SourceConnector.class); expectConfigValidation(connectorMock, true, config); - worker.stopAndAwaitConnector(CONNECTOR_NAME); - EasyMock.expectLastCall(); + doNothing().when(worker).stopAndAwaitConnector(CONNECTOR_NAME); + + final ArgumentCaptor<Callback<TargetState>> onStart = ArgumentCaptor.forClass(Callback.class); - Capture<Callback<TargetState>> onStart = EasyMock.newCapture(); - worker.startConnector(eq(CONNECTOR_NAME), eq(config), EasyMock.anyObject(HerderConnectorContext.class), - eq(herder), eq(TargetState.STARTED), EasyMock.capture(onStart)); Exception exception = new ConnectException("Failed to start connector"); - EasyMock.expectLastCall().andAnswer(() -> { + doAnswer(invocation -> { onStart.getValue().onCompletion(exception, null); return true; - }); - - PowerMock.replayAll(); + }).when(worker).startConnector(eq(CONNECTOR_NAME), eq(config), any(HerderConnectorContext.class), + eq(herder), eq(TargetState.STARTED), onStart.capture()); herder.putConnectorConfig(CONNECTOR_NAME, config, false, createCallback); Herder.Created<ConnectorInfo> connectorInfo = createCallback.get(1000L, TimeUnit.SECONDS); Review Comment: So this is the only place where there is a failure, at this point in the test it fails with an ``` org.apache.kafka.connect.errors.ConnectException: Failed to start connector java.util.concurrent.ExecutionException: org.apache.kafka.connect.errors.ConnectException: Failed to start connector ``` exception which is actually the same exception defined at https://github.com/apache/kafka/pull/12728/files#diff-9143727aad47387b8283893ef39610c7f135264077f795f70a6f1d67f7db6e21R367. I have gone through the test trying to figure out why its failing but it seems to be expected behaviour because maybe the test was written wrong? @C0urante @divijvaidya @clolov Maybe you have some idea? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org