Closed trnguyencflt closed 10 months ago
@trnguyencflt Is there a way to make this change non-breaking? To
Leaving two methods that annotate with @BeforeEach (if we would keep setUp() and add setUp(TestInfo)) could be problematic as Junit5 will pickup any function (including super class) with this annotation to run before a test (with no particular order), thus we could introduce unexpected behaviour in tests of downstream projects (suppose that the test only override setUp()).
How about having both setup()
& setup(Testinfo)
? Apply @BeforeEach
to only setup(Testinfo)
. And then setup()
could call setup(Testinfo)
with a custom TestInfo object that setups the calling test for ZK.
@msn-tldr
Apply @BeforeEach to only setup(Testinfo). And then setup() could call setup(Testinfo) with a custom TestInfo object that setups the calling test for ZK.
I tried this idea, unfortunately it doesn't work 😞 because JUnit5 will look for every method with @BeforeEach
annotation, including superclasses, so if any subclass override setup()
and with @BeforeEach
annotation, the tests in that subclass end up calling two setUp, which create two controller instances, and will lead to out of memory issue because one of them will not be teardown.
@msn-tldr
Apply https://github.com/beforeeach to only setup(Testinfo). And then setup() could call setup(Testinfo) with a custom TestInfo object that setups the calling test for ZK.
Actually, I think this might work in the sense that I'll update all the integration tests of downstream projects anyway, so no breaking change and we are sure that there isn't memory leak problem introduced.
Actually, I think this might work in the sense that I'll update all the integration tests of downstream projects anyway, so no breaking change and we are sure that there isn't memory leak problem introduced.
@msn-tldr unfortunately, this doesn't work because this goes against junit5 @BeforeEach
recommendation of not having more than two methods that depends on each other.
What
This PR migrates:
ClusterTestHarness
to be able to create both Zookeeper and Kraft based clusters, the change includes:setUp()
withsetUp(TestInfo)
breaking changesoverrideKraftControllerSecurityProtocol
,overrideKraftControllerConfig
,brokerTime
andisKraftTest
KafkaBrokerFixture
to be able to create Kafka cluster on either Zookeeper and Kraft controller, the change is done by replacingZookeeperFixture
withQuorumControllerFixture
. AFAIK, there is no downstream project that useZookeeperFixture
so this change is not breaking downstream dependencies.Recommendation for the reviewers
As the change in this PR are quite big (59 files, +/-1800), it might look intimidating for reviewing. However, it should be easy to review if you follow those steps:
String quorum
in test method is required.References
https://confluentinc.atlassian.net/browse/KREST-9993