Skip to content

Commit

Permalink
Merge pull request #556 from annaibm/addRedirect
Browse files Browse the repository at this point in the history
Add follow redirect in querying
  • Loading branch information
LongyuZhang authored May 29, 2024
2 parents 3ed8f8b + 2faba91 commit 5215bf4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/org/testKitGen/TestDivider.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ private void divideOnTestTime(List<List<String>> parallelLists, List<Integer> te
if (testDuration < limitFactor) {
Map.Entry<Integer,Integer> entry = new AbstractMap.SimpleEntry<>(index, testDuration);
machineQueue.offer(entry);
} else {
} else {
/* If the test time is greater than the limiting factor, set it as the new limiting factor. */
limitFactor = testDuration;
System.out.println("Warning: Test " + testName + " has duration " + formatTime(testDuration) + ", which is greater than the specified test list execution time " + testTime + "m. So this value is used to limit the overall execution time.");
}
index++;

}
}
}
Expand Down Expand Up @@ -107,19 +107,19 @@ private void divideOnMachineNum(List<List<String>> parallelLists, List<Integer>
}

private String constructURL(String impl, String plat, String group, String level) {
int limit = 10; // limit the number of builds used to calculate the average duration
int limit = 10; // limit the number of builds used to calculate the average duration
String URL = (arg.getTRSSURL().isEmpty() ? Constants.TRSS_URL : arg.getTRSSURL()) + "/api/getTestAvgDuration?limit=" + limit + "&jdkVersion=" + arg.getJdkVersion() + "&impl=" + impl + "&platform=" + plat;

if (tt.isSingleTest()) {
URL += "&testName=" + tt.getTestTargetName();
} else if (tt.isCategory()) {
if (!group.equals("")) {
URL += "&group=" + group;
URL += "&group=" + group;
}
if (!level.equals("")) {
URL += "&level=" + level;
URL += "&level=" + level;
}
}
}
return URL;
}

Expand Down Expand Up @@ -226,7 +226,7 @@ private Map<String, Integer> getDataFromTRSS() {
String level = getLevel();
Map<String, Integer> map = new HashMap<String, Integer>();
String URL = constructURL(impl, plat, group, level);
String command = "curl --silent --max-time 120 " + URL;
String command = "curl --silent --max-time 120 -L " + URL;
System.out.println("Attempting to get test duration data from TRSS.");
System.out.println(command);
Process process;
Expand All @@ -241,6 +241,7 @@ private Map<String, Integer> getDataFromTRSS() {
parseDuration(responseReader, map);
} catch (IOException | ParseException e) {
System.out.println("Warning: cannot parse data from TRSS.");
e.printStackTrace();
}
return map;
}
Expand Down Expand Up @@ -294,7 +295,7 @@ private Queue<Map.Entry<String, Integer>> createDurationQueue() {
}
}

System.out.println("\nTEST DURATION");
System.out.println("\nTEST DURATION");
System.out.println("====================================================================================");
System.out.println("Total number of tests searched: " + numOfTests);
int foundNum = numOfTests - testsNotFound.size() - testsInvalid.size();
Expand Down

0 comments on commit 5215bf4

Please sign in to comment.