flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject flume git commit: FLUME-2936. KafkaSource tests: Use loopback instead of host address
Date Sat, 09 Jul 2016 22:11:07 GMT
Repository: flume
Updated Branches:
  refs/heads/trunk 188c3104a -> 209c1e254


FLUME-2936. KafkaSource tests: Use loopback instead of host address

TestKafkaSource is flaky because it tries to run Kafka on the host
address instead of the loopback address. This patch fixes that problem.

It also introduces a bug fix related to passing properties to
KafkaSourceEmbeddedKafka.

(Lior Zeno via Mike Percy)


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

Branch: refs/heads/trunk
Commit: 209c1e2548080525919fe78a1a61cc8fc7ab306f
Parents: 188c310
Author: Mike Percy <mpercy@apache.org>
Authored: Sat Jul 9 15:05:33 2016 -0700
Committer: Mike Percy <mpercy@apache.org>
Committed: Sat Jul 9 15:05:33 2016 -0700

----------------------------------------------------------------------
 .../flume/source/kafka/KafkaSourceEmbeddedKafka.java   | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/209c1e25/flume-ng-sources/flume-kafka-source/src/test/java/org/apache/flume/source/kafka/KafkaSourceEmbeddedKafka.java
----------------------------------------------------------------------
diff --git a/flume-ng-sources/flume-kafka-source/src/test/java/org/apache/flume/source/kafka/KafkaSourceEmbeddedKafka.java
b/flume-ng-sources/flume-kafka-source/src/test/java/org/apache/flume/source/kafka/KafkaSourceEmbeddedKafka.java
index b72c532..a3a2f92 100644
--- a/flume-ng-sources/flume-kafka-source/src/test/java/org/apache/flume/source/kafka/KafkaSourceEmbeddedKafka.java
+++ b/flume-ng-sources/flume-kafka-source/src/test/java/org/apache/flume/source/kafka/KafkaSourceEmbeddedKafka.java
@@ -30,22 +30,13 @@ import org.apache.kafka.common.serialization.StringSerializer;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.util.Properties;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
 
 public class KafkaSourceEmbeddedKafka {
 
-  public static String HOST;
-
-  static {
-    try {
-      HOST = InetAddress.getLocalHost().getHostAddress();
-    } catch (UnknownHostException e) {
-      throw new RuntimeException("Host address can not be obtained", e);
-    }
-  }
+  public static String HOST = InetAddress.getLoopbackAddress().getHostAddress();
 
   KafkaServerStartable kafkaServer;
   KafkaSourceEmbeddedZookeeper zookeeper;
@@ -71,7 +62,7 @@ public class KafkaSourceEmbeddedKafka {
     props.put("port", String.valueOf(serverPort));
     props.put("log.dir", dir.getAbsolutePath());
     if (properties != null) {
-      props.putAll(props);
+      props.putAll(properties);
     }
     KafkaConfig config = new KafkaConfig(props);
     kafkaServer = new KafkaServerStartable(config);


Mime
View raw message