You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/01/21 23:27:54 UTC

[GitHub] [helix] mgao0 opened a new pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

mgao0 opened a new pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693
 
 
   ### Issues
   
   - [ ] My PR addresses the following Helix issues and references them in the PR description:
   
   #689
   
   ### Description
   
   - [ ] Here are some details about my PR, including screenshots of any UI changes:
   
   There is sometimes test failing because some znodes created in a test method didn't get deleted and it makes another test method's result false because we use one Zk cluster for all test methods in the same test class.
   I added code to delete the created znodes at the end of each test method so each test method is truly independent.
   
   ### Tests
   
   - [ ] The following tests are written for this issue:
   
   (List the names of added unit/integration tests)
   
   - [ ] The following is the result of the "mvn test" command on the appropriate module:
   
   (Copy & paste the result of "mvn test")
   
   ### Commits
   
   - [ ] My commits all reference appropriate Apache Helix GitHub issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [ ] In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Code Quality
   
   - [ ] My diff has been formatted using helix-style.xml

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang merged pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
jiajunwang merged pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] pkuwm commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#discussion_r369317301
 
 

 ##########
 File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
 ##########
 @@ -37,13 +37,15 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+
 public class TestZKUtil extends ZkUnitTestBase {
   private static Logger LOG = LoggerFactory.getLogger(TestZKUtil.class);
 
   String clusterName = CLUSTER_PREFIX + "_" + getShortClassName();
 
   @BeforeClass()
-  public void beforeClass() throws Exception {
+  public void beforeClass()
+      throws Exception {
 
 Review comment:
   Nit, this line is unnecessary. Style format file is updated in master branch. You may want to re-import the file in your Intellij so this line won't be formatted. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#discussion_r370789642
 
 

 ##########
 File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
 ##########
 @@ -63,6 +65,13 @@ public void afterClass() {
     deleteCluster(clusterName);
   }
 
+  @AfterMethod()
+  public void afterMethod() {
+    String path = PropertyPathBuilder.instanceConfig(clusterName);
+    _gZkClient.deleteRecursively(path);
+    _gZkClient.createPersistent(path);
 
 Review comment:
   I checked the test cases one by one, there is no test which is testing to create the root path (please correct me if I am wrong). Given so, re-create the root path is easier and safer.
   If we really have a case that requires the root path non-exists, feel free to change that test.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] mgao0 commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
mgao0 commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#issuecomment-578260151
 
 
   This PR is ready to be merged, approved by @jiajunwang 
   Final commit message:
   Removed useless znodes to resolve dependency between test methods in TestZKUtil

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] mgao0 commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
mgao0 commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#discussion_r370784950
 
 

 ##########
 File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
 ##########
 @@ -63,6 +65,13 @@ public void afterClass() {
     deleteCluster(clusterName);
   }
 
+  @AfterMethod()
+  public void afterMethod() {
+    String path = PropertyPathBuilder.instanceConfig(clusterName);
+    _gZkClient.deleteRecursively(path);
+    _gZkClient.createPersistent(path);
 
 Review comment:
   I agree it can cause unnecessary delete operation calls such as in `testIsClusterSetup`, but it doesn't add too much latency since what it does is deleting the nodes, not recreating the cluster . It is also safer than leaving the clean up responsibility to each method, as it can make sure the cluster is clean for each test method. I think both way work and it's barely a trade off.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#issuecomment-576936779
 
 
   Looks good. But please rebase the PR so we are seeing your change only.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#issuecomment-577846878
 
 
   It would be easier if we have beforeTest() and afterTest() methods which create and clean up the root path before and after each tests.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] pkuwm commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#discussion_r370497284
 
 

 ##########
 File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
 ##########
 @@ -63,6 +65,13 @@ public void afterClass() {
     deleteCluster(clusterName);
   }
 
+  @AfterMethod()
+  public void afterMethod() {
+    String path = PropertyPathBuilder.instanceConfig(clusterName);
+    _gZkClient.deleteRecursively(path);
+    _gZkClient.createPersistent(path);
 
 Review comment:
   - This is like delete and re-create the cluster, which I don't believe is a better way than deleting the path in the required methods.
   - Not every method needs deleting. Ex. `testIsClusterSetup`.
   - In my opinion, if a method creates the path, it is the method's responsibility to clean up.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] mgao0 commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil

Posted by GitBox <gi...@apache.org>.
mgao0 commented on issue #693: Removed useless znodes to resolve dependency between test methods in TestZKUtil
URL: https://github.com/apache/helix/pull/693#issuecomment-577846740
 
 
   This PR is ready to be merged, approved by @pkuwm @alirezazamani 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org