You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uniffle.apache.org by ro...@apache.org on 2022/10/12 12:11:06 UTC

[incubator-uniffle] 02/03: Fix Flaky test GetShuffleReportForMultiPartTest (#241)

This is an automated email from the ASF dual-hosted git repository.

roryqi pushed a commit to branch branch-0.6
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git

commit 7088e5f00923e1cb631180b7154a93fa365f3a00
Author: Xianming Lei <31...@users.noreply.github.com>
AuthorDate: Fri Sep 23 22:18:58 2022 +0800

    Fix Flaky test GetShuffleReportForMultiPartTest (#241)
    
    ### What changes were proposed in this pull request?
    ```
    org.opentest4j.AssertionFailedError: expected: <0> but was: <-218>
            at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
            at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
            at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
            at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145)
            at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:527)
            at org.apache.uniffle.test.GetShuffleReportForMultiPartTest.validateRequestCount(GetShuffleReportForMultiPartTest.java:198)
            at org.apache.uniffle.test.GetShuffleReportForMultiPartTest.runTest(GetShuffleReportForMultiPartTest.java:185)
            at org.apache.uniffle.test.SparkIntegrationTestBase.runSparkApp(SparkIntegrationTestBase.java:74)
            at org.apache.uniffle.test.SparkIntegrationTestBase.run(SparkIntegrationTestBase.java:59)
            at org.apache.uniffle.test.GetShuffleReportForMultiPartTest.resultCompareTest(GetShuffleReportForMultiPartTest.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
            at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
            at
    ```
    
    ### Why are the changes needed?
    Fix flaky test
    
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    UT passed
    
    Co-authored-by: leixianming <le...@didiglobal.com>
---
 .../org/apache/uniffle/test/GetShuffleReportForMultiPartTest.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetShuffleReportForMultiPartTest.java b/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetShuffleReportForMultiPartTest.java
index 899970ce..ec7a7c93 100644
--- a/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetShuffleReportForMultiPartTest.java
+++ b/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetShuffleReportForMultiPartTest.java
@@ -182,17 +182,17 @@ public class GetShuffleReportForMultiPartTest extends SparkIntegrationTestBase {
       int expectRequestNum = mockRssShuffleManager.getShuffleIdToPartitionNum().values().stream()
           .mapToInt(x -> x.get()).sum();
       // Validate getShuffleResultForMultiPart is correct before return result
-      validateRequestCount(expectRequestNum * replicateRead);
+      validateRequestCount(spark.sparkContext().applicationId(), expectRequestNum * replicateRead);
     }
     return map;
   }
 
-  public void validateRequestCount(int expectRequestNum) {
+  public void validateRequestCount(String appId, int expectRequestNum) {
     for (ShuffleServer shuffleServer : shuffleServers) {
       MockedShuffleServerGrpcService service = ((MockedGrpcServer) shuffleServer.getServer()).getService();
       Map<String, Map<Integer, AtomicInteger>> serviceRequestCount = service.getShuffleIdToPartitionRequest();
-      int requestNum = serviceRequestCount.entrySet().stream().flatMap(x -> x.getValue().values()
-           .stream()).mapToInt(AtomicInteger::get).sum();
+      int requestNum = serviceRequestCount.entrySet().stream().filter(x -> x.getKey().startsWith(appId))
+          .flatMap(x -> x.getValue().values().stream()).mapToInt(AtomicInteger::get).sum();
       expectRequestNum -= requestNum;
     }
     assertEquals(0, expectRequestNum);