Status

Current state: Under Discussion

Discussion thread: here 

JIRA: KAFKA-15258


Motivation

MockConsumer and MockProducer are part of the public API. They are useful for developers wanting to test their applications. On the other hand MockAdminClient is not part of the public API (it's under test). We should consider moving it to src so users can also easily test applications that depend on Admin. (Mentioned in KAFKA-15258)

MockAdminClient should be used only for testing purposes and shouldn't be used in production environments.

Every kafka developer needs to create topics, acls and more and would like to test in their applications directly. Without setting up kafka broker, if developer can mock all these functionalities in their code, it could help in time and effort. However downside is, developer should be careful in not using these in prod envs.

Public Interfaces

There is no change to existing public interfaces

Proposed Changes

  • Move MockAdminClient to src folder under org.apache.kafka.clients.admin
  • Update dependency tests after refactoring

Update Usage of MockAdminClient

     Update MockAdminClient with new behaviour and how users are expected to use it.

  • Creating a MockAdminClient
  • createTopics
  • listTopics
  • describeTopics
  • deleteTopics
  • createPartitions
  • describeConsumerGroups
  • listConsumerGroups
  • listConsumerGroupOffsets
  • deleteConsumerGroups
  • deleteConsumerGroupOffsets
  • create/delete/describe acls
  • describeLogDirs
  • describeReplicaLogDirs
  • metrics

Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users?
  • If we are changing behavior how will we phase out the older behavior?
  • If we need special migration tools, describe them here.
  • When will we remove the existing behavior?

Test Plan

Describe in few sentences how the KIP will be tested. We are mostly interested in system tests (since unit-tests are specific to implementation details). How will we know that the implementation works as expected? How will we know nothing broke?

Rejected Alternatives

If there are alternative ways of accomplishing the same thing, what were they? The purpose of this section is to motivate why the design is the way it is and not some other way.

  • No labels