-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tests] Fix flaky WrongTypeOfReturnValue Mockito misuse issue in broker tests #13621
Conversation
…lue issue in broker tests - replace spying of a instance with a spy created by Mockito with given constructor arguments
52048fe
to
e9b4816
Compare
This is to also fix issues like this:
This problem persisted after making #13608 change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@lhotari I have tried to cherry-pick this PR into branch-2.8, but there are many conflicts with branch-2.8. Do you want to push a PR to branch-2.8 directly? |
@codelipenghui I can deal with it next week. |
Thanks @lhotari |
@lhotari I still can get this flaky test. https://github.com/apache/pulsar/runs/4976572806?check_suite_focus=true |
@gaozhangmin thanks, I'll reopen #13620 |
@lhotari - since we're still observing test failures, is it worth cherry-picking this to 2.8? There are many conflicts when I just attempted to cherry-pick this commit. |
Same as @michaeljmarshall mentioned, I move this PR to |
Fixes #13620
Motivation
Mockito spy creation fails sporadically and causes an exception and Mockito misuse warning:
example failure
Additional context
The exception message gives this hint:
the
doReturn
family of methods is already used so it must be some other problem.The assumption of the solution in this PR is that when an instance spy is replaced with a mock that internally creates the spy instance using the given class and constructor arguments would solve the issue.
Modifications
spyWithClassAndConstructorArgs