liyuheng55555 commented on code in PR #10988:
URL: https://github.com/apache/iotdb/pull/10988#discussion_r1309685677
##########
integration-test/src/main/java/org/apache/iotdb/it/env/cluster/env/AbstractEnv.java:
##########
@@ -242,7 +243,30 @@ public String getTestClassName() {
return "UNKNOWN-IT";
}
- public void testWorking() {
+ private Map<String, Integer> countNodeStatus(Map<Integer, String>
nodeStatus) {
+ Map<String, Integer> result = new HashMap<>();
+ nodeStatus.values().forEach(status -> result.put(status,
result.getOrDefault(status, 0) + 1));
+ return result;
+ }
+
+ private final Predicate<Map<Integer, String>> statusCheckNoUnknown =
+ nodeStatus -> countNodeStatus(nodeStatus).getOrDefault("Unknown", 0) ==
0;
+
+ private final Predicate<Map<Integer, String>>
statusCheckOneUnknownThreeRunning =
+ nodeStatus -> {
+ Map<String, Integer> count = countNodeStatus(nodeStatus);
+ return count.getOrDefault("Unknown", 0) == 1 &&
count.getOrDefault("Running", 0) == 3;
+ };
+
+ public void testWorkingAllFine() {
+ testWorking(statusCheckNoUnknown);
+ }
+
+ public void testWorkingSpecial() {
+ testWorking(statusCheckOneUnknownThreeRunning);
+ }
+
+ private void testWorking(Predicate<Map<Integer, String>> statusCheck) {
Review Comment:
Constructive feedback !
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]