You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Guozhang Wang (JIRA)" <ji...@apache.org> on 2017/12/14 18:29:00 UTC

[jira] [Commented] (KAFKA-6363) Use MockAdminClient for any unit tests that depend on AdminClient

    [ https://issues.apache.org/jira/browse/KAFKA-6363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16291310#comment-16291310 ] 

Guozhang Wang commented on KAFKA-6363:
--------------------------------------

From the previous discussion:

{code}
cmccabe 3 days ago  Contributor
Reposting some of the stuff I said offline here:

It's great that we now have a MockAdminClient. This is something we discussed having before, but never got around to doing. As @guozhangwang said, MockKafkaAdminClientEnv is really just useful for testing KafkaAdminClient.

I don't completely understand the proposal for removing MockKafkaAdminClientEnv -- it still seems useful for KafkaAdminClientTest-- but I'm probably missing something here. Is the idea to make it a static class in KafkaAdminClientTest? That might be good.


guozhangwang a minute ago  Contributor
@cmccabe We could consider using a MockClient and added a new static constructor that takes a KafkaClient for KafkaAdminClientTest; this is basically what MockKafkaAdminClientEnv does.
{code}

> Use MockAdminClient for any unit tests that depend on AdminClient
> -----------------------------------------------------------------
>
>                 Key: KAFKA-6363
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6363
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Guozhang Wang
>              Labels: newbie
>
> Today we have a few unit tests other than KafkaAdminClientTest that relies on MockKafkaAdminClientEnv.
> About this class and MockKafkaAdminClientEnv, my thoughts:
> 1. MockKafkaAdminClientEnv is actually using a MockClient for the inner KafkaClient; it should be only used for the unit test of KafkaAdminClient itself.
> 2. For any other unit tests on classes that depend on AdminClient, we should be using the MockAdminClient that mocks the whole AdminClient.
> So I suggest 1) in TopicAdminTest use MockAdminClient instead; 2) in KafkaAdminClientTest use MockClient and added a new static constructor that takes a KafkaClient; 3) remove the MockKafkaAdminClientEnv.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)