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/05 11:44:53 UTC

[GitHub] [shardingsphere] terrymanu commented on a diff in pull request #21969: Add openGauss for DynamicLoadingSQLParserParameterizedTest

terrymanu commented on code in PR #21969:
URL: https://github.com/apache/shardingsphere/pull/21969#discussion_r1014624707


##########
test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/engine/DynamicLoadingSQLParserParameterizedTest.java:
##########
@@ -68,17 +70,32 @@ private static Collection<Map<String, String>> getResponse(final String sqlCaseU
         String casesGitHubApiContent = getContent(casesGitHubApiURL);
         List<String> casesName = JsonPath.parse(casesGitHubApiContent).read("$..name");
         List<String> casesDownloadURL = JsonPath.parse(casesGitHubApiContent).read("$..download_url");
+        List<String> casesHtmlURL = JsonPath.parse(casesGitHubApiContent).read("$..html_url");
         IntStream.range(0, JsonPath.parse(casesGitHubApiContent).read("$.length()"))
-                .forEach(each -> result.add(ImmutableMap.of("name", casesName.get(each), "download_url", casesDownloadURL.get(each))));
+                .forEach(each -> {
+                    String eachName = casesName.get(each);
+                    if (eachName.endsWith(".sql") || eachName.endsWith(".test")) {
+                        result.add(ImmutableMap.of("name", eachName, "download_url", casesDownloadURL.get(each)));
+                    } else if (!eachName.contains(".")) {
+                        result.addAll(getResponse(casesHtmlURL.get(each)));
+                    }
+                });
         return result;
     }
     
-    private static String getContent(final String url) throws IOException {
-        InputStreamReader in = new InputStreamReader(new URL(url).openStream());
-        return new BufferedReader(in).lines().collect(Collectors.joining(System.lineSeparator()));
+    private static String getContent(final String url) {
+        String result = "";
+        try {
+            InputStreamReader in = new InputStreamReader(new URL(url).openStream());
+            result = new BufferedReader(in).lines().collect(Collectors.joining(System.lineSeparator()));
+        } catch (IOException ingore) {
+            log.warn("Error: GitHub API rate limit exceeded");
+            System.exit(0);

Review Comment:
   Please just return empty String. System.exit will stop all other test cases!



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