You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/10/05 21:21:02 UTC

[GitHub] [kafka] cmccabe opened a new pull request #11383: KAFKA-13340: Change ZooKeeperTestHarness to QuorumTestHarness

cmccabe opened a new pull request #11383:
URL: https://github.com/apache/kafka/pull/11383


   Change ZooKeeperTestHarness to QuorumTestHarness so that integration tests which inherit from this
   class can test both ZK and KRaft mode. Test cases which do this can specify the modes they support
   by including a ParameterizedTest annotation before each test case, like the following:
   
   >  @ParameterizedTest
   >  @ValueSource(strings = Array("zk", "kraft"))
   >  def testValidCreateTopicsRequests(quorum: String): Unit = { ... }
   
   For each value that is specified here (zk, kraft), the test case will be run once in the appropriate
   mode. So the test shown above is run twice. This allows integration tests to be incrementally
   converted over to support KRaft mode, rather than rewritten to support it. As you might expect, test
   cases which do not specify a quorum argument will continue to run only in ZK mode.
   
   JUnit5 makes the quorum annotation visible in the TestInfo object which each @BeforeEach function in
   a test can optionally take. Therefore, this PR converts over the setUp function of the quorum base
   class, plus every derived class, to take a TestInfo argument. The TestInfo object gets "passed up
   the chain" to the base class, where it determines which quorum type we create (zk or kraft).
   
   The general approach taken here is to make as much as possible work with KRaft, but to leave some
   things as ZK-only when appropriate. For example, a test that explicitly requests an AdminZkClient
   object will get an exception if it is running in KRaft mode. Similarly, tests which explicitly
   request KafkaServer rather than KafkaBroker will get an exception when running in KRaft mode.
   
   As a proof of concept, this PR converts over CreateTopicsRequestTest to support KRaft. This is a
   good proof of concept because it is a very "deeply nested" test class (it has 5 base classes).
   
   Some notable changes in each file:
   
   KafkaServerTestHarness: add a "brokers" method, which replaces "servers" in KRaft-compatible tests.
   Create KRaft brokers when configured to do so.
   
   BaseRequestTest: add KRaft implementations for functions to fetch various socket server objects.
   
   TestUtils: add KRaft-compatible versions of many utility functions.
   
   ZooKeeperTestHarness: rename to QuorumTestHarness. Change the setUp function to take a TestInfo
   object and configure the test appropriately (for KRaft or ZK) based on this.
   
   BrokerServer: lifecycleManager should be final and initialized in the constructor, so that the
   object state is always available.
   
   KafkaBroker: add more accessor methods to this base class for the ZK and the KRaft broker.
   
   IntegrationTestHarness: set the controller endpoint when in KRaft mode.
   
   Create TestInfoUtils to house utility functions for reading and writing TestInfo objects.
   
   ReplicationControlManager.java: harmonize TOPIC_ALREADY_EXISTS error text with
   the zk case.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] cmccabe commented on pull request #11383: KAFKA-13340: Change ZooKeeperTestHarness to QuorumTestHarness

Posted by GitBox <gi...@apache.org>.
cmccabe commented on pull request #11383:
URL: https://github.com/apache/kafka/pull/11383#issuecomment-958015023


   Duplicate of #11417 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] cmccabe commented on pull request #11383: KAFKA-13340: Change ZooKeeperTestHarness to QuorumTestHarness

Posted by GitBox <gi...@apache.org>.
cmccabe commented on pull request #11383:
URL: https://github.com/apache/kafka/pull/11383#issuecomment-958015023


   Duplicate of #11417 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] cmccabe closed pull request #11383: KAFKA-13340: Change ZooKeeperTestHarness to QuorumTestHarness

Posted by GitBox <gi...@apache.org>.
cmccabe closed pull request #11383:
URL: https://github.com/apache/kafka/pull/11383


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] cmccabe closed pull request #11383: KAFKA-13340: Change ZooKeeperTestHarness to QuorumTestHarness

Posted by GitBox <gi...@apache.org>.
cmccabe closed pull request #11383:
URL: https://github.com/apache/kafka/pull/11383


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org