Skip to content

Commit

Permalink
fixed non-idempotent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyaok2 committed May 1, 2024
1 parent 0c9e0b4 commit c26f50f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.hadoop.mapred;

import org.junit.Assert;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.RawComparator;
Expand Down Expand Up @@ -119,7 +120,11 @@ public int compare(Text o1, Text o2) {

@Test
public void testCombiner() throws Exception {
if (!new File(TEST_ROOT_DIR).mkdirs()) {
File testDir = new File(TEST_ROOT_DIR);
if (testDir.exists()) {
FileUtil.fullyDelete(testDir);
}
if (!testDir.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + TEST_ROOT_DIR);
}
File in = new File(TEST_ROOT_DIR, "input");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.hadoop.mapreduce;

import org.junit.Assert;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.RawComparator;
Expand Down Expand Up @@ -105,7 +106,11 @@ public int compare(Text o1, Text o2) {

@Test
public void testCombiner() throws Exception {
if (!new File(TEST_ROOT_DIR).mkdirs()) {
File testDir = new File(TEST_ROOT_DIR);
if (testDir.exists()) {
FileUtil.fullyDelete(testDir);
}
if (!testDir.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + TEST_ROOT_DIR);
}
File in = new File(TEST_ROOT_DIR, "input");
Expand Down

0 comments on commit c26f50f

Please sign in to comment.