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


   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 MetricsTest to support KRaft.


-- 
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-unsubscr...@kafka.apache.org

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


Reply via email to