-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Fix ZkNoNodeException when zookeeper server is empty. #901
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #901 +/- ##
=============================================
- Coverage 38.7% 38.33% -0.38%
- Complexity 1026 1028 +2
=============================================
Files 220 222 +2
Lines 8492 8621 +129
Branches 1023 1044 +21
=============================================
+ Hits 3287 3305 +18
- Misses 4814 4926 +112
+ Partials 391 390 -1
Continue to review full report at Codecov.
|
...covery-zk/src/test/java/io/seata/discovery/registry/zk/ZookeeperRegisterServiceImplTest.java
Outdated
Show resolved
Hide resolved
...covery-zk/src/test/java/io/seata/discovery/registry/zk/ZookeeperRegisterServiceImplTest.java
Outdated
Show resolved
Hide resolved
...covery-zk/src/test/java/io/seata/discovery/registry/zk/ZookeeperRegisterServiceImplTest.java
Outdated
Show resolved
Hide resolved
...discovery-zk/src/test/java/io/seata/discovery/registry/zk/ZookeeperRegistryProviderTest.java
Outdated
Show resolved
Hide resolved
...discovery-zk/src/test/java/io/seata/discovery/registry/zk/ZookeeperRegistryProviderTest.java
Outdated
Show resolved
Hide resolved
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.
thanks.i left some comments.
@xingfudeshi done~ |
ZookeeperRegistryProvider provider = new ZookeeperRegistryProvider(); | ||
RegistryService registryService = provider.provide(); | ||
Assert.assertTrue(registryService instanceof ZookeeperRegisterServiceImpl); | ||
Assert.assertEquals(registryService, provider.provide()); |
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.
this line can be removed.
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.
This line is for testing the return singleton ZookeeperRegisterServiceImpl
.
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.
it's not necessary.the code
Assert.assertEquals(registryService, provider.provide());
will always pass even the registryService is null,because the registryService was returned by calling provider.provide()
RegistryService registryService = provider.provide();
@Test | ||
public void provide() { | ||
ZookeeperRegistryProvider provider = new ZookeeperRegistryProvider(); | ||
RegistryService registryService = provider.provide(); |
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.
and this line can be removed too.
the Assert.assertTrue(registryService instanceof ZookeeperRegisterServiceImpl);
can be replaced with the following code:
Assert.assertTrue(provider.provide() instanceof ZookeeperRegisterServiceImpl);
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.
This line is for testing the return singleton ZookeeperRegisterServiceImpl
.
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.
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.
+1
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Fixes #900
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews