kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwens...@apache.org
Subject kafka git commit: KAFKA-2355; Add an unit test to validate the deletion of a partition marked as deleted; patched by Edward Ribeiro, reviewed by Ashish Singh, Ismael Juma and Grant Henke
Date Thu, 23 Jul 2015 16:17:53 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 18adec7ed -> 66c8647d8


KAFKA-2355;  Add an unit test to validate the deletion of a partition marked as deleted; patched
by Edward Ribeiro, reviewed by Ashish Singh, Ismael Juma and Grant Henke


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

Branch: refs/heads/trunk
Commit: 66c8647d85f801893b9f882a7ad49242cef683fd
Parents: 18adec7
Author: Edward Ribeiro <edward.ribeiro@gmail.com>
Authored: Thu Jul 23 09:17:19 2015 -0700
Committer: Gwen Shapira <cshapi@gmail.com>
Committed: Thu Jul 23 09:17:19 2015 -0700

----------------------------------------------------------------------
 .../unit/kafka/admin/DeleteTopicTest.scala      | 23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/66c8647d/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala b/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala
index fa8ce25..c38df80 100644
--- a/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala
+++ b/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala
@@ -24,7 +24,7 @@ import kafka.utils.{ZkUtils, TestUtils}
 import kafka.server.{KafkaServer, KafkaConfig}
 import org.junit.Test
 import java.util.Properties
-import kafka.common.TopicAndPartition
+import kafka.common.{TopicAlreadyMarkedForDeletionException, TopicAndPartition}
 
 class DeleteTopicTest extends JUnit3Suite with ZooKeeperTestHarness {
 
@@ -249,6 +249,27 @@ class DeleteTopicTest extends JUnit3Suite with ZooKeeperTestHarness {
     servers.foreach(_.shutdown())
   }
 
+  @Test
+  def testDeleteTopicAlreadyMarkedAsDeleted() {
+    val topicAndPartition = TopicAndPartition("test", 0)
+    val topic = topicAndPartition.topic
+    val servers = createTestTopicAndCluster(topic)
+
+    try {
+      // start topic deletion
+      AdminUtils.deleteTopic(zkClient, topic)
+      // try to delete topic marked as deleted
+      AdminUtils.deleteTopic(zkClient, topic)
+      fail("Expected TopicAlreadyMarkedForDeletionException")
+    }
+    catch {
+      case e: TopicAlreadyMarkedForDeletionException => // expected exception
+    }
+
+    TestUtils.verifyTopicDeletion(zkClient, topic, 1, servers)
+    servers.foreach(_.shutdown())
+  }
+
   private def createTestTopicAndCluster(topic: String): Seq[KafkaServer] = {
 
     val brokerConfigs = TestUtils.createBrokerConfigs(3, zkConnect, false)


Mime
View raw message