From 50792c8765458c93e4d3632a0b76be4ef4354a60 Mon Sep 17 00:00:00 2001 From: Jun Rao Date: Fri, 7 Sep 2012 03:57:32 +0000 Subject: [PATCH] Transient failure in ProducerTest; patched by Jun Rao; reviewed by Neha Narkhede; kafka-471 git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1381858 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/scala/unit/kafka/producer/ProducerTest.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/test/scala/unit/kafka/producer/ProducerTest.scala b/core/src/test/scala/unit/kafka/producer/ProducerTest.scala index 7c416fe95e5..8486a8b354e 100644 --- a/core/src/test/scala/unit/kafka/producer/ProducerTest.scala +++ b/core/src/test/scala/unit/kafka/producer/ProducerTest.scala @@ -162,7 +162,7 @@ class ProducerTest extends JUnit3Suite with ZooKeeperTestHarness with Logging{ val producer2 = new Producer[String, String](producerConfig2) // Available partition ids should be 0. producer1.send(new ProducerData[String, String]("new-topic", "test", Array("test1"))) - producer1.send(new ProducerData[String, String]("new-topic", "test", Array("test1"))) + producer1.send(new ProducerData[String, String]("new-topic", "test", Array("test2"))) // get the leader val leaderOpt = ZkUtils.getLeaderForPartition(zkClient, "new-topic", 0) assertTrue("Leader for topic new-topic partition 0 should exist", leaderOpt.isDefined) @@ -179,8 +179,10 @@ class ProducerTest extends JUnit3Suite with ZooKeeperTestHarness with Logging{ assertEquals(new Message("test1".getBytes), messageSet.next.message) assertTrue("Message set should have 1 message", messageSet.hasNext) - assertEquals(new Message("test1".getBytes), messageSet.next.message) - assertFalse("Message set should not have any more messages", messageSet.hasNext) + assertEquals(new Message("test2".getBytes), messageSet.next.message) + if (messageSet.hasNext) + fail("Message set should not have any more messages, but received a message of %s" + .format(Utils.toString(messageSet.next.message.payload, "UTF-8"))) producer1.close() try {