You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "twitchob (via GitHub)" <gi...@apache.org> on 2023/03/28 06:26:14 UTC

[GitHub] [shardingsphere] twitchob opened a new issue, #24878: Build failure in windows environment due to line breaks(\r\n in winidows

twitchob opened a new issue, #24878:
URL: https://github.com/apache/shardingsphere/issues/24878

   ## Question
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   ## Hi!community. When I solve this problem (#24806),another problem arose:
   
   ```-------------------------------------------------------------------------------
   Test set: org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest
   -------------------------------------------------------------------------------
   Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.354 s <<< FAILURE! - in org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest
   org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest.assertExecuteWithEmptyMetaData  Time elapsed: 0.048 s  <<< FAILURE!
   java.lang.AssertionError: 
   
   Expected: is "{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: null\\ndataSources:\\nrules:\\n\"},\"props\":\"\",\"rules\":\"\"}}"
        but: was "{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: null\\r\\ndataSources:\\r\\nrules:\\r\\n\"},\"props\":\"\",\"rules\":\"\"}}"
   	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
   	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
   	at org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest.assertExecuteWithEmptyMetaData(ExportMetaDataExecutorTest.java:87)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
   	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.jar/nva:727) 
   ```
   
   ## I found that the reason is that the newline character in the window environment(/r/n) is inconsistent with that in linux (/r).
   
   I changed this in the unit test:
   
   In class org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutorTest row 107
   `assertThat(row.getCell(3), is("{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: null\\ndataSources:\\nrules:\\n\"},\"props\":\"\",\"rules\":\"\"}}"));` 
   is changed to
   `assertThat(row.getCell(3), is("{\"meta_data\":{\"databases\":{\"empty_metadata\":\"databaseName: null\\r\\ndataSources:\\r\\nrules:\\r\\n\"},\"props\":\"\",\"rules\":\"\"}}"));`
   
   ## add `/r` for json files
   ![image](https://user-images.githubusercontent.com/34822229/228145006-17c21ca0-a200-4f95-97f6-06994eda8490.png)
   
   ##  windows.json replace export-metadata-configuration.json
   ![image](https://user-images.githubusercontent.com/34822229/228146267-b2e7b533-a61b-4056-b914-49488160ba58.png)
   
   ## Build success
   ![image](https://user-images.githubusercontent.com/34822229/228146562-67526407-b533-41be-9a85-253ee535d2b1.png)
   
   ## But I think this is very inelegant. Is there a way to solve this problem without modifying the code?
   


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

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


[GitHub] [shardingsphere] twitchob commented on issue #24878: Build failure in windows environment due to line breaks(\r\n in winidows & \n in linux)

Posted by "twitchob (via GitHub)" <gi...@apache.org>.
twitchob commented on issue #24878:
URL: https://github.com/apache/shardingsphere/issues/24878#issuecomment-1502771895

   > Is it possible to replace hard coded separator with `java.io.File#separator` in test codes?
   
   ## Expected is a file not String ,so I can`t add `System.separator` in it.
   
   ## Not only is this unit test problematic, but other tests with newlines can also be problematic.
   
   ![1681195548098](https://user-images.githubusercontent.com/34822229/231078253-5b8967f4-42d5-43a1-87c0-59ec2dd1e1f1.png)
   
   ![1681195478879](https://user-images.githubusercontent.com/34822229/231078272-a9880a46-24df-4b19-a8b0-b7d17b2858af.png)
   


-- 
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] TeslaCN commented on issue #24878: Build failure in windows environment due to line breaks(\r\n in winidows & \n in linux)

Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN commented on issue #24878:
URL: https://github.com/apache/shardingsphere/issues/24878#issuecomment-1498809744

   Is it possible to replace hard coded separator with `java.io.File#separator` in test codes?


-- 
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] TeslaCN commented on issue #24878: Build failure in windows environment due to line breaks(\r\n in winidows & \n in linux)

Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN commented on issue #24878:
URL: https://github.com/apache/shardingsphere/issues/24878#issuecomment-1506405645

   Or could we do some replacing operations after read expected String from file?


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