kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject kafka git commit: KAFKA-3037: Test number of alive brokers known after single node cluster startup
Date Fri, 05 Feb 2016 21:16:14 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk fa05ee727 -> 26efdede6


KAFKA-3037: Test number of alive brokers known after single node cluster startup

…ter startup

Author: Grant Henke <granthenke@gmail.com>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #875 from granthenke/self-aware


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

Branch: refs/heads/trunk
Commit: 26efdede6c31904935c66de3bd979fa4edab624d
Parents: fa05ee7
Author: Grant Henke <granthenke@gmail.com>
Authored: Fri Feb 5 13:15:57 2016 -0800
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Fri Feb 5 13:15:57 2016 -0800

----------------------------------------------------------------------
 .../scala/unit/kafka/server/ServerStartupTest.scala | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/26efdede/core/src/test/scala/unit/kafka/server/ServerStartupTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/server/ServerStartupTest.scala b/core/src/test/scala/unit/kafka/server/ServerStartupTest.scala
index 145f00a..b321a02 100755
--- a/core/src/test/scala/unit/kafka/server/ServerStartupTest.scala
+++ b/core/src/test/scala/unit/kafka/server/ServerStartupTest.scala
@@ -68,4 +68,18 @@ class ServerStartupTest extends ZooKeeperTestHarness {
     server1.shutdown()
     CoreUtils.rm(server1.config.logDirs)
   }
-}
\ No newline at end of file
+
+  @Test
+  def testBrokerSelfAware {
+    val brokerId = 0
+    val props = TestUtils.createBrokerConfig(brokerId, zkConnect)
+    val server = TestUtils.createServer(KafkaConfig.fromProps(props))
+
+    TestUtils.waitUntilTrue(() => server.metadataCache.getAliveBrokers.nonEmpty, "Wait
for cache to update")
+    assertEquals(1, server.metadataCache.getAliveBrokers.size)
+    assertEquals(brokerId, server.metadataCache.getAliveBrokers.head.id)
+
+    server.shutdown()
+    CoreUtils.rm(server.config.logDirs)
+  }
+}


Mime
View raw message