-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
Use singleton RegistryProtocol in tests #3849
Conversation
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.
Can you send an error stack?
For example, when the tests [testNotifyOverride_notmatch, testExportUrlNull, testNotifyOverride] are run in this order, the test testNotifyOverride fails with the error: testNotifyOverride Time elapsed: 0.022 s <<< ERROR!
|
Hi, I can reproduce this issue by adding the following code: @Test
public void test() throws Exception {
testNotifyOverride_notmatch();
testExportUrlNull();
testNotifyOverride();
} Excpetion:
I think you are right, we should use |
@OrDTesters I am trying to contact you privately, but got no response from ordtesters at gmail.com. If you happen to receive this message please check your email, or contact me privately via huxing at apache.org |
Hello, I am very sorry for having not respond in so long. Please let me know if there is anything more you want to discuss. |
@OrDTesters Please check you email: ordtesters at gmail.com. I have sent an email to that address in April or May. You can also leave me an email address that you can receive email, or contact me privately via huxing at apache.org |
What is the purpose of the change
Currently some tests in RegistryProtocolTest do not use the RegistryProtocol.getRegistryProtocol() method to get the singleton RegistryProtocol instance. These tests directly create new instances of RegistryProtocol, which changes the singleton to point to the newly created instance. Doing so leads to tests in test class to fail when run in certain orders. For example, running the tests [testNotifyOverride_notmatch, testExportUrlNull, testNotifyOverride] in that exact order leads to testNotifyOverride to fail.
The proposed change is to have every test use the RegistryProtocol.getRegistryProtocol() method to get the same instance of RegistryProtocol.
Brief changelog
dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java