You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ce...@apache.org on 2022/10/07 14:14:27 UTC
[kafka] branch trunk updated: KAFKA-14283: Fix connector creation Auth tests (#12721)
This is an automated email from the ASF dual-hosted git repository.
cegerton pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new de056658768 KAFKA-14283: Fix connector creation Auth tests (#12721)
de056658768 is described below
commit de0566587680ce8bfedbb1e493296ef6c0a37707
Author: Matthew de Detrich <ma...@aiven.io>
AuthorDate: Fri Oct 7 09:14:15 2022 -0500
KAFKA-14283: Fix connector creation Auth tests (#12721)
Reviewers: Sagar Rao <sa...@gmail.com>, Chris Egerton <ch...@aiven.io>
---
.../runtime/rest/resources/ConnectorsResourceTest.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResourceTest.java b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResourceTest.java
index ba89a21c89f..e3048684c2c 100644
--- a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResourceTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResourceTest.java
@@ -334,8 +334,11 @@ public class ConnectorsResourceTest {
EasyMock.expect(httpHeaders.getHeaderString("Authorization")).andReturn("Basic YWxhZGRpbjpvcGVuc2VzYW1l").times(1);
EasyMock.replay(httpHeaders);
herder.putConnectorConfig(EasyMock.eq(CONNECTOR_NAME), EasyMock.eq(body.config()), EasyMock.eq(false), EasyMock.capture(cb));
- expectAndCallbackResult(cb, new Herder.Created<>(true, new ConnectorInfo(CONNECTOR_NAME, CONNECTOR_CONFIG,
- CONNECTOR_TASK_NAMES, ConnectorType.SOURCE)));
+ expectAndCallbackNotLeaderException(cb);
+
+ EasyMock.expect(RestClient.httpRequest(EasyMock.eq(LEADER_URL + "connectors?forward=false"),
+ EasyMock.eq("POST"), EasyMock.eq(httpHeaders), EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject(WorkerConfig.class)))
+ .andReturn(new RestClient.HttpResponse<>(202, new HashMap<>(), null));
PowerMock.replayAll();
@@ -354,8 +357,11 @@ public class ConnectorsResourceTest {
EasyMock.expect(httpHeaders.getHeaderString("Authorization")).andReturn(null).times(1);
EasyMock.replay(httpHeaders);
herder.putConnectorConfig(EasyMock.eq(CONNECTOR_NAME), EasyMock.eq(body.config()), EasyMock.eq(false), EasyMock.capture(cb));
- expectAndCallbackResult(cb, new Herder.Created<>(true, new ConnectorInfo(CONNECTOR_NAME, CONNECTOR_CONFIG,
- CONNECTOR_TASK_NAMES, ConnectorType.SOURCE)));
+ expectAndCallbackNotLeaderException(cb);
+
+ EasyMock.expect(RestClient.httpRequest(EasyMock.eq(LEADER_URL + "connectors?forward=false"),
+ EasyMock.eq("POST"), EasyMock.eq(httpHeaders), EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject(WorkerConfig.class)))
+ .andReturn(new RestClient.HttpResponse<>(202, new HashMap<>(), null));
PowerMock.replayAll();