You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gw...@apache.org on 2016/04/20 19:16:51 UTC

kafka git commit: MINOR: Remove RollingBounceTest since its functionality is covered by the ReplicationTest system test

Repository: kafka
Updated Branches:
  refs/heads/trunk 0bf61039c -> 280efe7f7


MINOR: Remove RollingBounceTest since its functionality is covered by the ReplicationTest system test

RollingBounceTest is a system test that cannot be run reliably in unit tests and ReplicationTest is a superset of the
functionality: in addition to verifying that bouncing leaders eventually results in a new leader, ReplicationTest also
validates that data continues to be produced and consumed.

Author: Ewen Cheslack-Postava <me...@ewencp.org>

Reviewers: Gwen Shapira

Closes #1242 from ewencp/minor-remove-rolling-bounce-integration-test


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

Branch: refs/heads/trunk
Commit: 280efe7f789d21f0c45657e14830451c1c8fc2b4
Parents: 0bf6103
Author: Ewen Cheslack-Postava <me...@ewencp.org>
Authored: Wed Apr 20 10:16:44 2016 -0700
Committer: Gwen Shapira <cs...@gmail.com>
Committed: Wed Apr 20 10:16:44 2016 -0700

----------------------------------------------------------------------
 .../kafka/integration/RollingBounceTest.scala   | 95 --------------------
 1 file changed, 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/280efe7f/core/src/test/scala/unit/kafka/integration/RollingBounceTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/integration/RollingBounceTest.scala b/core/src/test/scala/unit/kafka/integration/RollingBounceTest.scala
deleted file mode 100755
index 5221855..0000000
--- a/core/src/test/scala/unit/kafka/integration/RollingBounceTest.scala
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package kafka.integration
-
-import org.junit.{Test, After, Before}
-import kafka.zk.ZooKeeperTestHarness
-import kafka.utils.TestUtils._
-import org.junit.Assert._
-import kafka.utils.{CoreUtils, TestUtils}
-import kafka.server.{KafkaConfig, KafkaServer}
-
-class RollingBounceTest extends ZooKeeperTestHarness {
-
-  val partitionId = 0
-  var servers: Seq[KafkaServer] = null
-
-  @Before
-  override def setUp() {
-    super.setUp()
-    // controlled.shutdown.enable is true by default
-    val configs = (0 until 4).map(i => TestUtils.createBrokerConfig(i, zkConnect))
-    configs(3).put("controlled.shutdown.retry.backoff.ms", "100")
- 
-    // start all the servers
-    servers = configs.map(c => TestUtils.createServer(KafkaConfig.fromProps(c)))
-  }
-
-  @After
-  override def tearDown() {
-    servers.foreach(_.shutdown())
-    servers.foreach(server => CoreUtils.delete(server.config.logDirs))
-    super.tearDown()
-  }
-
-  @Test
-  def testRollingBounce {
-    // start all the brokers
-    val topic1 = "new-topic1"
-    val topic2 = "new-topic2"
-    val topic3 = "new-topic3"
-    val topic4 = "new-topic4"
-
-    // create topics with 1 partition, 2 replicas, one on each broker
-    createTopic(zkUtils, topic1, partitionReplicaAssignment = Map(0->Seq(0,1)), servers = servers)
-    createTopic(zkUtils, topic2, partitionReplicaAssignment = Map(0->Seq(1,2)), servers = servers)
-    createTopic(zkUtils, topic3, partitionReplicaAssignment = Map(0->Seq(2,3)), servers = servers)
-    createTopic(zkUtils, topic4, partitionReplicaAssignment = Map(0->Seq(0,3)), servers = servers)
-
-    // Do a rolling bounce and check if leader transitions happen correctly
-
-    // Bring down the leader for the first topic
-    bounceServer(topic1, 0)
-
-    // Bring down the leader for the second topic
-    bounceServer(topic2, 1)
-
-    // Bring down the leader for the third topic
-    bounceServer(topic3, 2)
-
-    // Bring down the leader for the fourth topic
-    bounceServer(topic4, 3)
-  }
-
-  private def bounceServer(topic: String, startIndex: Int) {
-    var prevLeader = 0
-    if (isLeaderLocalOnBroker(topic, partitionId, servers(startIndex))) {
-      servers(startIndex).shutdown()
-      prevLeader = startIndex
-    }
-    else {
-      servers((startIndex + 1) % 4).shutdown()
-      prevLeader = (startIndex + 1) % 4
-    }
-    var newleader = waitUntilLeaderIsElectedOrChanged(zkUtils, topic, partitionId)
-    // Ensure the new leader is different from the old
-    assertTrue("Leader transition did not happen for " + topic, newleader.getOrElse(-1) != -1 && (newleader.getOrElse(-1) != prevLeader))
-    // Start the server back up again
-    servers(prevLeader).startup()
-  }
-}