-
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
[improve][test] remove WhiteBox on MockZooKeeper #17579
Conversation
Signed-off-by: tison <[email protected]>
MockZooKeeper zk = createMockZooKeeperInstance(executor, readOpDelayMs); | ||
ObjectInstantiator<ClientCnxn> clientCnxnObjectInstantiator = objenesis.getInstantiatorOf(ClientCnxn.class); | ||
Whitebox.setInternalState(zk, "cnxn", clientCnxnObjectInstantiator.newInstance()); | ||
return zk; | ||
return createMockZooKeeperInstance(executor, readOpDelayMs); |
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.
@eolivelli this change was added by you in #8590. I don't know why we need this WhiteBox
based mock and after removing it and running several tests, it seems all green.
Could you share some background here?
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.
Maybe the older versions of Mockito or other mock frameworks needed it
/pulsarbot run-failure-checks |
It's interesting that no test failed after remove the lines: ObjectInstantiator<ClientCnxn> clientCnxnObjectInstantiator = objenesis.getInstantiatorOf(ClientCnxn.class);
Whitebox.setInternalState(zk, "cnxn", clientCnxnObjectInstantiator.newInstance()); I suppose that since the |
MockZooKeeper zk = createMockZooKeeperInstance(executor, readOpDelayMs); | ||
ObjectInstantiator<ClientCnxn> clientCnxnObjectInstantiator = objenesis.getInstantiatorOf(ClientCnxn.class); | ||
Whitebox.setInternalState(zk, "cnxn", clientCnxnObjectInstantiator.newInstance()); | ||
return zk; | ||
return createMockZooKeeperInstance(executor, readOpDelayMs); |
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.
Maybe the older versions of Mockito or other mock frameworks needed it
(cherry picked from commit c1434fd)
…itebox on MockZooKeeper (#17579)
…n MockZooKeeper (#17579)
…itebox on MockZooKeeper (apache#17579) (cherry picked from commit 0cc5dce)
…n MockZooKeeper (apache#17579) (cherry picked from commit 8236311)
…itebox on MockZooKeeper (apache#17579) (cherry picked from commit 0cc5dce)
…n MockZooKeeper (apache#17579) (cherry picked from commit 8236311)
Master issue #16912
Documentation
doc-required
(Your PR needs to update docs and you will update later)
doc-not-needed
(Please explain why)
doc
(Your PR contains doc changes)
doc-complete
(Docs have been already added)