kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: KAFKA-5792; Fix Transient failure in KafkaAdminClientTest.testHandleTimeout
Date Sat, 09 Sep 2017 07:35:18 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 689a84c7d -> ae4100f82


KAFKA-5792; Fix Transient failure in KafkaAdminClientTest.testHandleTimeout

Author: Colin P. Mccabe <cmccabe@confluent.io>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #3822 from cmccabe/KAFKA-5792


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/ae4100f8
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/ae4100f8
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/ae4100f8

Branch: refs/heads/trunk
Commit: ae4100f82c13b3e6978c0a0f697312bd073e0eb3
Parents: 689a84c
Author: Colin P. Mccabe <cmccabe@confluent.io>
Authored: Sat Sep 9 08:33:08 2017 +0100
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Sat Sep 9 08:34:03 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/kafka/clients/admin/KafkaAdminClient.java    | 4 ++++
 .../org/apache/kafka/clients/admin/KafkaAdminClientTest.java     | 2 ++
 .../org/apache/kafka/clients/admin/MockKafkaAdminClientEnv.java  | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/ae4100f8/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java b/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
index 49ac93e..88d99c3 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
@@ -370,6 +370,10 @@ public class KafkaAdminClient extends AdminClient {
         thread.start();
     }
 
+    Time time() {
+        return time;
+    }
+
     @Override
     public void close(long duration, TimeUnit unit) {
         long waitTimeMs = unit.toMillis(duration);

http://git-wip-us.apache.org/repos/asf/kafka/blob/ae4100f8/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
b/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
index 96f7e8a..83416c6 100644
--- a/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
@@ -324,6 +324,8 @@ public class KafkaAdminClientTest {
             env.kafkaClient().setNodeApiVersions(NodeApiVersions.create());
             env.kafkaClient().prepareMetadataUpdate(env.cluster(), Collections.<String>emptySet());
             env.kafkaClient().setNode(nodes.get(0));
+            assertEquals(time, env.time());
+            assertEquals(env.time(), ((KafkaAdminClient) env.adminClient()).time());
 
             // Make a request with an extremely short timeout.
             // Then wait for it to fail by not supplying any response.

http://git-wip-us.apache.org/repos/asf/kafka/blob/ae4100f8/clients/src/test/java/org/apache/kafka/clients/admin/MockKafkaAdminClientEnv.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/clients/admin/MockKafkaAdminClientEnv.java
b/clients/src/test/java/org/apache/kafka/clients/admin/MockKafkaAdminClientEnv.java
index 6648467..9190da2 100644
--- a/clients/src/test/java/org/apache/kafka/clients/admin/MockKafkaAdminClientEnv.java
+++ b/clients/src/test/java/org/apache/kafka/clients/admin/MockKafkaAdminClientEnv.java
@@ -52,7 +52,7 @@ public class MockKafkaAdminClientEnv implements AutoCloseable {
     }
 
     public MockKafkaAdminClientEnv(Time time, Cluster cluster, Map<String, Object>
config) {
-        this.time = Time.SYSTEM;
+        this.time = time;
         this.adminClientConfig = new AdminClientConfig(config);
         this.cluster = cluster;
         this.metadata = new Metadata(adminClientConfig.getLong(AdminClientConfig.RETRY_BACKOFF_MS_CONFIG),


Mime
View raw message