You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/12/07 00:16:19 UTC

[GitHub] [dolphinscheduler] bmk15897 opened a new pull request, #13118: [Improve] Fixed Possible JSON ordering permutations problem in Tests

bmk15897 opened a new pull request, #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118

   ## Purpose of the pull request
   Flaky Test found using [NonDex](https://github.com/TestingResearchIllinois/NonDex) by running the command -
   ``` 
   mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=org.apache.dolphinscheduler.spi.params.PluginParamsTransferTest#testGetParamsJson
   ```
   The logged failure for the test
   org.apache.dolphinscheduler.spi.params.PluginParamsTransferTest.testGetParamsJson was 
   ```
   [INFO] Results:
   [INFO]
   [ERROR] Failures:
   [ERROR]   PluginParamsTransferTest.testGetParamsJson:181 expected: <[{"props":null,"field":"field1","name":"field1","type":"input","title":"field1","value":null,"validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":null}],"emit":null},{"props":null,"field":"field2","name":"field2","type":"input","title":"field2","value":null,"validate":null,"emit":null},{"props":null,"field":"field3","name":"field3","type":"input","title":"field3","value":null,"validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":null}],"emit":null},{"props":null,"field":"field4","name":"field4","type":"input","title":"field4","value":null,"validate":[{"required":true,"message":null,"type":"number","trigger":"blur","min":null,"max":null}],"emit":null},{"props":null,"field":"field5","name":"field5","type":"input","title":"field5","value":null,"validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":n
 ull}],"emit":null},{"props":null,"field":"field6","name":"field6","type":"radio","title":"field6","value":true,"validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":null}],"emit":null,"options":[{"label":"YES","value":true,"disabled":false},{"label":"NO","value":false,"disabled":false}]},{"props":{"disabled":null,"type":null,"maxlength":null,"minlength":null,"clearable":null,"prefixIcon":null,"suffixIcon":null,"rows":null,"autosize":null,"autocomplete":null,"name":null,"readonly":null,"max":null,"min":null,"step":null,"resize":null,"autofocus":null,"form":null,"label":null,"tabindex":null,"validateEvent":null,"showPassword":null,"placeholder":"if enable use authentication, you need input user","size":"small"},"field":"field7","name":"field7","type":"input","title":"field7","value":null,"validate":null,"emit":null},{"field":"field8","name":"field8","props":{"disabled":null,"placeholder":"if enable use authentication, you need input password","s
 ize":"small"},"type":"input","title":"field8","value":null,"validate":null,"emit":null},{"props":null,"field":"field9","name":"field9","type":"radio","title":"field9","value":false,"validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":null}],"emit":null,"options":[{"label":"YES","value":true,"disabled":false},{"label":"NO","value":false,"disabled":false}]},{"props":null,"field":"field10","name":"field10","type":"radio","title":"field10","value":false,"validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":null}],"emit":null,"options":[{"label":"YES","value":true,"disabled":false},{"label":"NO","value":false,"disabled":false}]},{"props":null,"field":"field11","name":"field11","type":"input","title":"field11","value":"*","validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":null}],"emit":null},{"props":null,"field":"showType","name":"showType","type":"radio","title":"s
 howType","value":"table","validate":[{"required":true,"message":null,"type":"string","trigger":"blur","min":null,"max":null}],"emit":null,"options":[{"label":"table","value":"table","disabled":false},{"label":"text","value":"text","disabled":false},{"label":"attachment","value":"attachment","disabled":false},{"label":"tableattachment","value":"tableattachment","disabled":false}]}]> but was: <[{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"value":null,"name":"field1","title":"field1","emit":null,"type":"input","field":"field1"},{"props":null,"validate":null,"value":null,"name":"field2","title":"field2","emit":null,"type":"input","field":"field2"},{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"value":null,"name":"field3","title":"field3","emit":null,"type":"input","field":"field3"},{"props":null,"validate":[{"trigger":"blur","type":"number","min":nu
 ll,"max":null,"message":null,"required":true}],"value":null,"name":"field4","title":"field4","emit":null,"type":"input","field":"field4"},{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"value":null,"name":"field5","title":"field5","emit":null,"type":"input","field":"field5"},{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"name":"field6","emit":null,"title":"field6","field":"field6","value":true,"type":"radio","options":[{"disabled":false,"label":"YES","value":true},{"disabled":false,"label":"NO","value":false}]},{"props":{"disabled":null,"readonly":null,"clearable":null,"name":null,"maxlength":null,"autofocus":null,"step":null,"autocomplete":null,"min":null,"autosize":null,"prefixIcon":null,"rows":null,"form":null,"minlength":null,"showPassword":null,"label":null,"suffixIcon":null,"resize":null,"tabindex":null,"type":null,"max":null,"validateEvent":
 null,"size":"small","placeholder":"if enable use authentication, you need input user"},"validate":null,"value":null,"name":"field7","title":"field7","emit":null,"type":"input","field":"field7"},{"validate":null,"title":"field8","props":{"disabled":null,"size":"small","placeholder":"if enable use authentication, you need input password"},"name":"field8","type":"input","emit":null,"field":"field8","value":null},{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"name":"field9","emit":null,"title":"field9","field":"field9","value":false,"type":"radio","options":[{"disabled":false,"label":"YES","value":true},{"disabled":false,"label":"NO","value":false}]},{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"name":"field10","emit":null,"title":"field10","field":"field10","value":false,"type":"radio","options":[{"disabled":false,"label":"YES","value":true},{"disab
 led":false,"label":"NO","value":false}]},{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"value":"*","name":"field11","title":"field11","emit":null,"type":"input","field":"field11"},{"props":null,"validate":[{"trigger":"blur","type":"string","min":null,"max":null,"message":null,"required":true}],"name":"showType","emit":null,"title":"showType","field":"showType","value":"table","type":"radio","options":[{"disabled":false,"label":"table","value":"table"},{"disabled":false,"label":"text","value":"text"},{"disabled":false,"label":"attachment","value":"attachment"},{"disabled":false,"label":"tableattachment","value":"tableattachment"}]}]>
   ```
   ### Investigation
   The test fails at PluginParamsTransferTest.testGetParamsJson:181 with a comparison error while comparing an expected string and the result from PluginParamsTransfer.transferParamsToJson function after converting it into String. The toString function of the Object class makes no guarantees as to the iteration order of the attributes in the object. This makes the test outcome non-deterministic and the test fails whenever the toString changes the order of the properties. To fix this, the expected and actual values should be checked in a more deterministic way so that the assertions do not fail.
   
   ## Brief change log
   
   Expected and Actual values can be converted into [JsonElement](https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/JsonElement.html) and then compared. As the JsonElements are compared without needing order, the test becomes deterministic and ensures that the flakiness from the test is removed.
   
   The PR does not introduce a breaking change.
   
   ## Verify this pull request
   
   
   This pull request is code cleanup without any test coverage.
   


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] bmk15897 commented on pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
bmk15897 commented on PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118#issuecomment-1341503410

   @Radeity You are correct, the order of elements in the List remain the same. But the order of elements in the json objects inside the list do not remain the same. As the funtion objectMapper.writeValueAsString(object) is used to convert the object into string without mentioning a SerializationFeature, the order of the key,value pairs is not guaranteed. So the test can fail or pass on the same version of the code. This flakiness detected by NonDex as shown in the error log can lead to test failures even though the json is the same(ignoring the order). So my solution is just to compare the jsons without considering the order. This ensures that the testcase passes.


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118#issuecomment-1341929648

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=13118)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=13118&metric=coverage&view=list) No Coverage information  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=13118&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=13118&metric=new_duplicated_lines_density&view=list)
   
   


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] EricGao888 commented on pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
EricGao888 commented on PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118#issuecomment-1342082361

   @bmk15897 Thanks very much for making your first contribution to Apache DolphinScheduler : )


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] bmk15897 commented on pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
bmk15897 commented on PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118#issuecomment-1341483490

   Thank you so much @EricGao888, I have updated the import order. Can you please review it now?


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] Radeity commented on pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
Radeity commented on PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118#issuecomment-1340295324

   Hi, @bmk15897 , i just wonder how many times you run the test and find one failure? AFAIK, `jackson` should keep the order when serialize `List`.


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] Radeity commented on pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
Radeity commented on PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118#issuecomment-1342017737

   > @Radeity You are correct, the order of elements in the List remain the same. But the order of elements in the json objects inside the list do not remain the same. As the funtion objectMapper.writeValueAsString(object) is used to convert the object into string without mentioning a SerializationFeature, the order of the key,value pairs is not guaranteed. So the test can fail or pass on the same version of the code. This flakiness detected by NonDex as shown in the error log can lead to test failures even though the json is the same(ignoring the order). So my solution is just to compare the jsons without considering the order. This ensures that the testcase passes.
   
   Get it, thanks for your explanation!


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] EricGao888 merged pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
EricGao888 merged PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #13118: [Improvement] Fixed Possible JSON ordering permutations problem in Tests

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #13118:
URL: https://github.com/apache/dolphinscheduler/pull/13118#issuecomment-1341929408

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=13118)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=13118&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=13118&metric=coverage&view=list) No Coverage information  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=13118&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=13118&metric=new_duplicated_lines_density&view=list)
   
   


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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org