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/04/28 22:45:17 UTC

[GitHub] [helix] pkuwm opened a new pull request #976: Fix incorrect exception type and confusing assertion messages

pkuwm opened a new pull request #976:
URL: https://github.com/apache/helix/pull/976


   ### Issues
   
   - [ ] My PR addresses the following Helix issues and references them in the PR description:
   
   Fixes #975 
   
   ### Description
   
   - [ ] Here are some details about my PR, including screenshots of any UI changes:
   
   The message should be "Should succeed because data size is **smaller** than 1M since compression applied"
   `HelixException` should be `ZkMarshallingError` because the exception type is changed in ZNRecord serializer.
   
   ### Tests
   
   - [ ] The following tests are written for this issue:
   
   TestZNRecordSizeLimit
   
   - [ ] The following is the result of the "mvn test" command on the appropriate module:
   
   Doesn't change any other code. Just ran this test.
   
   Default Suite
   Total tests run: 4, Failures: 0, Skips: 0
   
   ### Commits
   
   - [ ] My commits all reference appropriate Apache Helix GitHub issues in their subject lines. 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 (Optional)
   
   - [ ] 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 
   (helix-style-intellij.xml if IntelliJ IDE is used)


----------------------------------------------------------------
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



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


[GitHub] [helix] narendly merged pull request #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
narendly merged pull request #976:
URL: https://github.com/apache/helix/pull/976


   


----------------------------------------------------------------
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



---------------------------------------------------------------------
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 #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #976:
URL: https://github.com/apache/helix/pull/976#discussion_r417000219



##########
File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java
##########
@@ -86,8 +89,8 @@ public void testZNRecordSizeLimitUseZNRecordSerializer() {
     _gZkClient.createPersistent(path2, true);
     try {
       _gZkClient.writeData(path2, largeRecord);
-    } catch (HelixException e) {
-      Assert.fail("Should not fail because data size is larger than 1M since compression applied");
+    } catch (ZkMarshallingError e) {

Review comment:
       We are testing a `ZkMarshallingError` should not be thrown by the serializer. This message specifies the reason why this bad exception is thrown.
   FYI, exception stack trace is added to the message.




----------------------------------------------------------------
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



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


[GitHub] [helix] pkuwm commented on pull request #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
pkuwm commented on pull request #976:
URL: https://github.com/apache/helix/pull/976#issuecomment-623626200


   > Something wrong with your change? Only on test change, where is the code change? @pkuwm
   
   @dasahcc No main code change in this PR. This is a minor fix for the test. The exception change was already done in another PR: [here](https://github.com/apache/helix/pull/845)


----------------------------------------------------------------
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



---------------------------------------------------------------------
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 #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on a change in pull request #976:
URL: https://github.com/apache/helix/pull/976#discussion_r417011319



##########
File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java
##########
@@ -86,8 +89,8 @@ public void testZNRecordSizeLimitUseZNRecordSerializer() {
     _gZkClient.createPersistent(path2, true);
     try {
       _gZkClient.writeData(path2, largeRecord);
-    } catch (HelixException e) {
-      Assert.fail("Should not fail because data size is larger than 1M since compression applied");
+    } catch (ZkMarshallingError e) {

Review comment:
       I don't have a strong preference here. But I think it is redundant try-catch. Otherwise, why we are not adding this try-catch then throw exception blocks to all the test code? Because all test code, as long as it is not testing for the negative cases, will have the same assumption that we shall not have a certain Exception thrown.




----------------------------------------------------------------
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



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


[GitHub] [helix] pkuwm commented on pull request #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
pkuwm commented on pull request #976:
URL: https://github.com/apache/helix/pull/976#issuecomment-634441483


   This PR is ready to be merged, approved by @narendly 
   
   ```
   In TestZNRecordSizeLimit, the assertion message should indicate the data is smaller than 1 MB threshold. HelixException should be ZkMarshallingError because the exception type is changed in ZNRecord serializer.
   ```


----------------------------------------------------------------
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



---------------------------------------------------------------------
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 #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #976:
URL: https://github.com/apache/helix/pull/976#discussion_r417014257



##########
File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java
##########
@@ -86,8 +89,8 @@ public void testZNRecordSizeLimitUseZNRecordSerializer() {
     _gZkClient.createPersistent(path2, true);
     try {
       _gZkClient.writeData(path2, largeRecord);
-    } catch (HelixException e) {
-      Assert.fail("Should not fail because data size is larger than 1M since compression applied");
+    } catch (ZkMarshallingError e) {

Review comment:
       I understand your point. And I agree we shouldn’t do redundant code. But in this specific case here, since compression is such a critical part, I would prefer to make it bold. If there is anything change in the logic and triggers the test failed, the message should tell the reason. And one more reason I use assert.fail is to avoid that if someone changes the test and catch the exception Without failing the test , the exception thrown from here may not fail the test. This is what I would like to prevent.




----------------------------------------------------------------
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



---------------------------------------------------------------------
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 #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
jiajunwang commented on a change in pull request #976:
URL: https://github.com/apache/helix/pull/976#discussion_r416977623



##########
File path: helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java
##########
@@ -86,8 +89,8 @@ public void testZNRecordSizeLimitUseZNRecordSerializer() {
     _gZkClient.createPersistent(path2, true);
     try {
       _gZkClient.writeData(path2, largeRecord);
-    } catch (HelixException e) {
-      Assert.fail("Should not fail because data size is larger than 1M since compression applied");
+    } catch (ZkMarshallingError e) {

Review comment:
       What is this test log testing?
   
   If the expectation is no error, then we don't care what is the exception. If the operation fails, just throw it. If we use Assert.fail(), we get a message, but we are actually not sure the detail of the exception, because we never include it in the assert fail message.
   If the expectation is we have an error, then the assert in the catch block will fail the test.
   
   Can we make it straight?




----------------------------------------------------------------
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



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


[GitHub] [helix] dasahcc commented on pull request #976: Fix incorrect exception type and confusing assertion messages

Posted by GitBox <gi...@apache.org>.
dasahcc commented on pull request #976:
URL: https://github.com/apache/helix/pull/976#issuecomment-623609327


   Something wrong with your change? Only on test change, where is the code change? @pkuwm 


----------------------------------------------------------------
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



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