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/03/10 11:14:12 UTC

[incubator-uniffle] branch master updated: [MINOR] test: fix static field initialized before TempDir field injected (#707)

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 40685937 [MINOR] test: fix static field initialized before TempDir field injected (#707)
40685937 is described below

commit 406859377e57dfb7640267ae47af14748df50d0b
Author: advancedxy <xi...@apache.org>
AuthorDate: Fri Mar 10 19:14:06 2023 +0800

    [MINOR] test: fix static field initialized before TempDir field injected (#707)
    
    ### What changes were proposed in this pull request?
    fix UTs
    
    ### Why are the changes needed?
    Makes integration tests passed on local machines
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Manually verified.
---
 .../java/org/apache/uniffle/test/DiskErrorToleranceTest.java     | 9 +++++----
 .../org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java  | 6 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java b/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java
index f7916533..e00882dc 100644
--- a/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java
+++ b/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java
@@ -56,14 +56,15 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 public class DiskErrorToleranceTest extends ShuffleReadWriteBase {
   private ShuffleServerGrpcClient shuffleServerClient;
 
-  @TempDir private static File serverTmpDir;
-  private static File data1 = new File(serverTmpDir, "data1");
-  private static File data2 = new File(serverTmpDir, "data2");
+  private static File data1;
+  private static File data2;
   private List<ShuffleServerInfo> shuffleServerInfo =
       Lists.newArrayList(new ShuffleServerInfo("127.0.0.1-20001", LOCALHOST, SHUFFLE_SERVER_PORT));
 
   @BeforeAll
-  public static void setupServers() throws Exception {
+  public static void setupServers(@TempDir File serverTmpDir) throws Exception {
+    data1 = new File(serverTmpDir, "data1");
+    data2 = new File(serverTmpDir, "data2");
     CoordinatorConf coordinatorConf = getCoordinatorConf();
     createCoordinatorServer(coordinatorConf);
     ShuffleServerConf shuffleServerConf = getShuffleServerConf();
diff --git a/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java b/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java
index 96832b9b..8338aa92 100644
--- a/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java
+++ b/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java
@@ -46,12 +46,12 @@ import static org.junit.jupiter.api.Assertions.fail;
 
 public class HealthCheckCoordinatorGrpcTest extends CoordinatorTestBase  {
 
-  @TempDir private static File serverTmpDir;
-  private static File tempDataFile = new File(serverTmpDir, "data");
+  private static File tempDataFile;
   private static int writeDataSize;
 
   @BeforeAll
-  public static void setupServers() throws Exception {
+  public static void setupServers(@TempDir File serverTmpDir) throws Exception {
+    tempDataFile = new File(serverTmpDir, "data");
     File data1 = new File(serverTmpDir, "data1");
     data1.mkdirs();
     File data2 = new File(serverTmpDir, "data2");