[Testing] Improve integration test base classes#9672
Conversation
|
/pulsarbot run-failure-checks |
|
It looks like the failure on https://github.com/apache/pulsar/pull/9672/checks?check_run_id=1956401458 is genuine. |
Thanks for pointing that out. I'm able to reproduce the issue locally too. by cherry-picking the changes from #9626 , I can get the error message from the broker side. command to run the test and leave the container running for inspection: with |
|
@merlimat It seems that the original tests are invalid. In this case, the TestNG test suite is defined this way in What happens in the original code (before this PR) is that the containers get initialized for all test classes up-front. Since each test class uses BeforeSuite to start the containers and the container is held in a static field, this results in the last container to be initialized to be used for all test runs. I verified this behavior locally. Here is the output of Therefore, I think that deleting the failing test (SmokeTest2_2.testBatchIndexAckDisabled) is the way to resolve this. |
….3.0 - fails with exception on server side: "org.apache.pulsar.shaded.com.google.protobuf.v241.UninitializedMessageException: Message was missing required fields. (Lite runtime could not determine which fields were missing)." - test wasn't executed before because of usage of BeforeSuite and static fields for initializing the test container
e3267bf to
2359667
Compare
|
/pulsarbot run-failure-checks |
5 similar comments
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
Motivation
Integration test classes misuse BeforeSuite and AfterSuite annotations. When AfterSuite is used to cleanup resources, it results in resources piling up for the duration of the complete test suite run. It's like a memory leak since resources aren't properly cleaned up during test execution.
Some test classes implemented ITest, which caused misleading error messages from TestNG. There shouldn't be a need to implement ITest.
Besides the annotation issue, some resources were using static fields without a real reason.
The usage of BeforeSuite & static fields leads to issues such as the one described in the comment. For example for the backwards compatibility tests, the last container to get initialized will be used for all tests in the suite and the backwards compatibility isn't tested at all for other than the last container version.
Modifications
implements ITest