This is an automated email from the ASF dual-hosted git repository.
xianjingfeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 69522109f [MINOR] fix(test): fix flaky test
ServletTest.testUnhealthyNodesServlet (#1952)
69522109f is described below
commit 69522109f46317162b6d307f7e05b7c5f9511a41
Author: xianjingfeng <[email protected]>
AuthorDate: Fri Jul 26 11:17:25 2024 +0800
[MINOR] fix(test): fix flaky test ServletTest.testUnhealthyNodesServlet
(#1952)
### What changes were proposed in this pull request?
Fix flaky test ServletTest.testUnhealthyNodesServlet.
### Why are the changes needed?
In the original logic, shuffleIds will have three elements when only one
unhealthy node is obtained for the first time.
https://github.com/apache/incubator-uniffle/actions/runs/10086923444/job/27890257649?pr=1948
### Does this PR introduce any user-facing change?
No.
### How was this patch tested?
CI
---
.../test/java/org/apache/uniffle/test/ServletTest.java | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ServletTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ServletTest.java
index 2c10e6105..639ec11ab 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ServletTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ServletTest.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -227,7 +228,6 @@ public class ServletTest extends IntegrationTestBase {
shuffleServer3.markUnhealthy();
shuffleServer4.markUnhealthy();
List<String> expectShuffleIds = Arrays.asList(shuffleServer3.getId(),
shuffleServer4.getId());
- List<String> shuffleIds = new ArrayList<>();
Awaitility.await()
.atMost(30, TimeUnit.SECONDS)
.until(
@@ -237,13 +237,18 @@ public class ServletTest extends IntegrationTestBase {
TestUtils.httpGet(UNHEALTHYNODES_URL),
new TypeReference<Response<List<HashMap<String,
Object>>>>() {});
List<HashMap<String, Object>> serverList = response.getData();
- for (HashMap<String, Object> stringObjectHashMap : serverList) {
- String shuffleId = (String) stringObjectHashMap.get("id");
- shuffleIds.add(shuffleId);
+ if (serverList.size() != 2) {
+ return false;
}
- return serverList.size() == 2;
+
+ List<String> shuffleIds =
+ serverList.stream()
+ .map(serverInfo -> (String) serverInfo.get("id"))
+ .collect(Collectors.toList());
+
+ assertTrue(CollectionUtils.isEqualCollection(expectShuffleIds,
shuffleIds));
+ return true;
});
- assertTrue(CollectionUtils.isEqualCollection(expectShuffleIds,
shuffleIds));
}
@Test