You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2018/04/11 21:50:16 UTC

[kafka] branch trunk updated: MINOR: Fix AsyncProducerTest bug that hits when logging is turned up (#4450)

This is an automated email from the ASF dual-hosted git repository.

ijuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e4d652b  MINOR: Fix AsyncProducerTest bug that hits when logging is turned up (#4450)
e4d652b is described below

commit e4d652befe3a4ac126dced9144c1b694e7334a94
Author: Colin Patrick McCabe <co...@cmccabe.xyz>
AuthorDate: Wed Apr 11 14:50:11 2018 -0700

    MINOR: Fix AsyncProducerTest bug that hits when logging is turned up (#4450)
    
    AsyncProducerTest gets an error about an incorrect mock when the logging
    level is turned up.  Instead of usIng a mock, just create a real
    SyncProducerConfig object, since the object is simple to create.
    
    Reviewers: Ismael Juma <is...@juma.me.uk>
---
 core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala b/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala
index 74f3ad1..370a1ad 100755
--- a/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala
+++ b/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala
@@ -404,8 +404,11 @@ class AsyncProducerTest {
       Map((TopicAndPartition("topic1", 0), ProducerResponseStatus(Errors.NONE, 0L))))
     val mockSyncProducer = EasyMock.createMock(classOf[SyncProducer])
     // don't care about config mock
-    val mockConfig = EasyMock.createNiceMock(classOf[SyncProducerConfig])
-    EasyMock.expect(mockSyncProducer.config).andReturn(mockConfig).anyTimes()
+    val myProps = new Properties()
+    myProps.put("host", "localhost")
+    myProps.put("port", "9092")
+    val myConfig = new SyncProducerConfig(myProps)
+    EasyMock.expect(mockSyncProducer.config).andReturn(myConfig).anyTimes()
     EasyMock.expect(mockSyncProducer.send(request1)).andThrow(new RuntimeException) // simulate SocketTimeoutException
     EasyMock.expect(mockSyncProducer.send(request2)).andReturn(response1)
     EasyMock.expect(mockSyncProducer.send(request3)).andReturn(response2)

-- 
To stop receiving notification emails like this one, please contact
ijuma@apache.org.