You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uniffle.apache.org by ck...@apache.org on 2023/01/12 07:50:04 UTC

[incubator-uniffle] branch master updated: [ISSUE-472] Fix Flaky Test: LocalFileServerReadHandlerTest#testDataInconsistent (#473)

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

ckj 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 7f89d6f6 [ISSUE-472] Fix Flaky Test: LocalFileServerReadHandlerTest#testDataInconsistent (#473)
7f89d6f6 is described below

commit 7f89d6f61b525d18095d882662c8ef684e2f913f
Author: Junfan Zhang <zu...@apache.org>
AuthorDate: Thu Jan 12 15:49:58 2023 +0800

    [ISSUE-472] Fix Flaky Test: LocalFileServerReadHandlerTest#testDataInconsistent (#473)
    
    ### What changes were proposed in this pull request?
    
    1. Reset the static variable to fix LocalFileServerReadHandlerTest#testDataInconsistent
    
    ### Why are the changes needed?
    
    Fix flaky test
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    1. Existing UTs
---
 .../apache/uniffle/storage/handler/impl/LocalFileHandlerTestBase.java | 4 ++++
 .../uniffle/storage/handler/impl/LocalFileServerReadHandlerTest.java  | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTestBase.java b/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTestBase.java
index 5c1b5294..c1458f8f 100644
--- a/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTestBase.java
+++ b/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTestBase.java
@@ -44,6 +44,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 public class LocalFileHandlerTestBase {
   private static AtomicLong ATOMIC_LONG = new AtomicLong(0L);
 
+  public static void reset() {
+    ATOMIC_LONG = new AtomicLong(0L);
+  }
+
   public static void writeTestData(
       ShuffleWriteHandler writeHandler,
       int num, int length,
diff --git a/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileServerReadHandlerTest.java b/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileServerReadHandlerTest.java
index e2dcfd5b..f247c2d4 100644
--- a/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileServerReadHandlerTest.java
+++ b/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileServerReadHandlerTest.java
@@ -43,6 +43,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 public class LocalFileServerReadHandlerTest {
   @Test
   public void testDataInconsistent() throws Exception {
+    LocalFileHandlerTestBase.reset();
+
     Map<Long, byte[]> expectedData = Maps.newHashMap();
     int expectTotalBlockNum = 4;
     int blockSize = 7;