Skip to content

Commit

Permalink
[MINOR] test: fix static field initialized before TempDir field injec…
Browse files Browse the repository at this point in the history
…ted (#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.
  • Loading branch information
advancedxy committed Mar 10, 2023
1 parent 4b5bf10 commit 4068593
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@

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");
Expand Down

0 comments on commit 4068593

Please sign in to comment.