Mihir-Rabari opened a new pull request, #3385: URL: https://github.com/apache/hugegraph/pull/3385
Fixes #3384 RaftEngineReadIndexTest swaps a mock into the RaftEngine singleton and re-stubs readIndex on it inside its tests. When an earlier suite test leaves the singleton started and leading, the pd-raft-alive-peers refresher calls listAlivePeers() on that same mock whenever the state machine reports a leader, and a call from that thread while a doAnswer(...).when(mock).readIndex(...) is in progress is what Mockito reports as an UnfinishedStubbingException, so the suite fails now and then. I reproduced it against the real refresher: starting the singleton the way PdTestBase does and looping the answerShutdown stubbing against an installed mock, Mockito blew up with UnfinishedStubbingException after ~131k re-stubs, while with the machine kept not-leader the same loop ran ~168k re-stubs cleanly and the refresher never touched the mock (verify(mock, never()).listAlivePeers()). The fix is test-only: announce no leader term in setUp, before the mock is installed, so the refresher leaves the mock alone, and announce the term in testReadIndexInTermKeepsTheTermTakenBeforeTheWait only after its re-stubbing has completed. The refresher itself is untouched — it still reads the node and the term exactly as before whenever the singleton leads. Verification: mvn test -pl hugegraph-pd/hg-pd-test -P pd-core-test twice (Tests run: 190, Failures: 0, Errors: 0 both runs), editorconfig:check and the apache-rat license check clean. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
