amrishlal opened a new pull request #6326: URL: https://github.com/apache/incubator-pinot/pull/6326
**Description** This PR addresses issue #5688. Most (195/208) test cases under pinot-controller were modified to use common shared state (Zookeeper, Pinot Controller, Broker, and Server instances) inside a TestNG suite (see `testng.xml`and `ControllerTestSetup.java`).Some (13/208) test cases could not be migrated over as they were not compatible with shared state model. These tests cases are in testng-old-tests.xml suite and run as before (i.e each test allocates and deallocates state). **testng.xml suite** TestNG invokes the `@BeforeSuite` method in `ControllerTestSetup` where the shared state (Zookeeper, Pinot Controller, Broker and Server instances) is initialized before any of the tests run. Each test case class, that uses shared state, has a `@BeforeClass` method where `ControllerTestUtils.validate()` function is called to ensure that shared state is clean. If the `validate()` function does not assert, the `@Test` functions in the class are run. At the end of each test class, the `@AfterClass` function is called which in turn calls `ControllerTestUtils.cleanup()` to clean up shared state to avoid conflict with subsequent test classes. Once all the test classes are done executing, TestNG invokes the `@AfterSuite` method in ControllerTestSetup to de-initialize the shared state to prevent conflicts with subsequent test suites. **testng-old-tests.xml suite** This suite can be deleted once all the test cases listed here are migrated over to testng.xml suite. **Performance** Before this change, pinot-controller test cases took ~5 minutes to run. After this PR, pinot-controller test cases take ~2 minutes to run: ``` BEFORE: Tests run: 207, Failures: 0, Errors: 0, Skipped: 0[INFO] [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 04:54 min [INFO] Finished at: 2020-12-01T10:46:58-08:00 [INFO] ------------------------------------------------------------------------ AFTER: [INFO] Tests run: 208, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:10 min [INFO] Finished at: 2020-12-06T21:48:24-08:00 [INFO] ------------------------------------------------------------------------ ``` **maven-surefire-plugin** Maven surefire plugin version number was upgraded to 3.0.0-M5 since the earlier version was causing test cases defined in the suite two execute two times. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
