You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/14 15:56:33 UTC

[GitHub] [shardingsphere] yx9o opened a new pull request, #22176: Enhance the test case of ConvertYamlConfigurationHandler.

yx9o opened a new pull request, #22176:
URL: https://github.com/apache/shardingsphere/pull/22176

   Add validation for generated sql.
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] codecov-commenter commented on pull request #22176: Enhance the test case of ConvertYamlConfigurationHandler.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #22176:
URL: https://github.com/apache/shardingsphere/pull/22176#issuecomment-1314757618

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/22176?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22176](https://codecov.io/gh/apache/shardingsphere/pull/22176?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c6f3307) into [master](https://codecov.io/gh/apache/shardingsphere/commit/9d94744161fe312dda595851a780b6174d69e4ec?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9d94744) will **decrease** coverage by `0.02%`.
   > The diff coverage is `46.01%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #22176      +/-   ##
   ============================================
   - Coverage     61.03%   61.00%   -0.03%     
   - Complexity     2544     2547       +3     
   ============================================
     Files          4120     4122       +2     
     Lines         57324    57438     +114     
     Branches       9705     9734      +29     
   ============================================
   + Hits          34985    35041      +56     
   - Misses        19389    19436      +47     
   - Partials       2950     2961      +11     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/22176?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ere/shadow/api/config/ShadowRuleConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvc2hhZG93L2FwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhZG93L2FwaS9jb25maWcvU2hhZG93UnVsZUNvbmZpZ3VyYXRpb24uamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ml/swapper/YamlShadowRuleConfigurationSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvc2hhZG93L2NvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYWRvdy95YW1sL3N3YXBwZXIvWWFtbFNoYWRvd1J1bGVDb25maWd1cmF0aW9uU3dhcHBlci5qYXZh) | `11.42% <0.00%> (-4.71%)` | :arrow_down: |
   | [...andler/update/AlterShadowRuleStatementUpdater.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvc2hhZG93L2Rpc3RzcWwvaGFuZGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhZG93L2Rpc3RzcWwvaGFuZGxlci91cGRhdGUvQWx0ZXJTaGFkb3dSdWxlU3RhdGVtZW50VXBkYXRlci5qYXZh) | `71.11% <0.00%> (+1.54%)` | :arrow_up: |
   | [...ndler/update/CreateShadowRuleStatementUpdater.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvc2hhZG93L2Rpc3RzcWwvaGFuZGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhZG93L2Rpc3RzcWwvaGFuZGxlci91cGRhdGUvQ3JlYXRlU2hhZG93UnVsZVN0YXRlbWVudFVwZGF0ZXIuamF2YQ==) | `62.85% <0.00%> (ø)` | |
   | [...etadata/data/ShardingStatisticsTableCollector.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvc2hhcmRpbmcvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvbWV0YWRhdGEvZGF0YS9TaGFyZGluZ1N0YXRpc3RpY3NUYWJsZUNvbGxlY3Rvci5qYXZh) | `0.00% <ø> (ø)` | |
   | [.../collector/ShardingSphereDataCollectorFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9kYXRhL2NvbGxlY3Rvci9TaGFyZGluZ1NwaGVyZURhdGFDb2xsZWN0b3JGYWN0b3J5LmphdmE=) | `0.00% <ø> (ø)` | |
   | [...a/data/collector/tables/PgClassTableCollector.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9kYXRhL2NvbGxlY3Rvci90YWJsZXMvUGdDbGFzc1RhYmxlQ29sbGVjdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...ta/collector/tables/PgNamespaceTableCollector.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9kYXRhL2NvbGxlY3Rvci90YWJsZXMvUGdOYW1lc3BhY2VUYWJsZUNvbGxlY3Rvci5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...ta/swapper/YamlShardingSphereTableDataSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS95YW1sL2RhdGEvc3dhcHBlci9ZYW1sU2hhcmRpbmdTcGhlcmVUYWJsZURhdGFTd2FwcGVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...e/execute/ShardingSphereDataScheduleCollector.java](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a2VybmVsL2RhdGEtcGlwZWxpbmUvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGF0YS9waXBlbGluZS9jb3JlL2V4ZWN1dGUvU2hhcmRpbmdTcGhlcmVEYXRhU2NoZWR1bGVDb2xsZWN0b3IuamF2YQ==) | `81.57% <ø> (ø)` | |
   | ... and [32 more](https://codecov.io/gh/apache/shardingsphere/pull/22176/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] RaigorJiang merged pull request #22176: Enhance the test case of ConvertYamlConfigurationHandler.

Posted by GitBox <gi...@apache.org>.
RaigorJiang merged PR #22176:
URL: https://github.com/apache/shardingsphere/pull/22176


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #22176: Enhance the test case of ConvertYamlConfigurationHandler.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on code in PR #22176:
URL: https://github.com/apache/shardingsphere/pull/22176#discussion_r1022257050


##########
proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandlerTest.java:
##########
@@ -123,9 +130,19 @@ private void assertQueryHeader(final QueryHeader actual) {
         assertFalse(actual.isAutoIncrement());
     }
     
-    private void assertRowData(final Collection<Object> actual, final String expectedFilePath) {
-        assertThat(actual.size(), is(1));
-        assertThat(actual.iterator().next(), is(loadExpectedRow(expectedFilePath)));
+    private void assertRowData(final Collection<Object> data, final String expectedFilePath) {
+        assertThat(data.size(), is(1));
+        Object actual = data.iterator().next();
+        assertThat(actual, is(loadExpectedRow(expectedFilePath)));
+        assertParseSQL((String) actual);
+    }
+    
+    private void assertParseSQL(final String actual) {
+        for (String each : Splitter.on(";").trimResults().splitToList(actual)) {
+            if (!Strings.isNullOrEmpty(each)) {
+                assertNotNull(sqlParserRule.getSQLParserEngine("MYSQL").parse(each, false));

Review Comment:
   Should databaseType be `MySQL`?



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] RaigorJiang commented on pull request #22176: Enhance the test case of ConvertYamlConfigurationHandler.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on PR #22176:
URL: https://github.com/apache/shardingsphere/pull/22176#issuecomment-1314851304

   @yx9o Merged, thank you!


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] yx9o commented on a diff in pull request #22176: Enhance the test case of ConvertYamlConfigurationHandler.

Posted by GitBox <gi...@apache.org>.
yx9o commented on code in PR #22176:
URL: https://github.com/apache/shardingsphere/pull/22176#discussion_r1022293895


##########
proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandlerTest.java:
##########
@@ -123,9 +130,19 @@ private void assertQueryHeader(final QueryHeader actual) {
         assertFalse(actual.isAutoIncrement());
     }
     
-    private void assertRowData(final Collection<Object> actual, final String expectedFilePath) {
-        assertThat(actual.size(), is(1));
-        assertThat(actual.iterator().next(), is(loadExpectedRow(expectedFilePath)));
+    private void assertRowData(final Collection<Object> data, final String expectedFilePath) {
+        assertThat(data.size(), is(1));
+        Object actual = data.iterator().next();
+        assertThat(actual, is(loadExpectedRow(expectedFilePath)));
+        assertParseSQL((String) actual);
+    }
+    
+    private void assertParseSQL(final String actual) {
+        for (String each : Splitter.on(";").trimResults().splitToList(actual)) {
+            if (!Strings.isNullOrEmpty(each)) {
+                assertNotNull(sqlParserRule.getSQLParserEngine("MYSQL").parse(each, false));

Review Comment:
   OK, thanks.



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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