MAPREDUCE-7270. TestHistoryViewerPrinter could be failed when the locale isn't English. (#1942)

Contributed by Sungpeo Kook.
Signed-off-by: Mingliang Liu <liuml07@apache.org>
This commit is contained in:
Sungpeo Kook 2021-04-08 15:58:10 +09:00 committed by GitHub
parent 6040e86e99
commit 46a5979805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -24,7 +24,9 @@ import org.apache.hadoop.mapreduce.Counters;
import org.apache.hadoop.mapreduce.JobID;
import org.apache.hadoop.mapreduce.JobStatus;
import org.apache.hadoop.mapreduce.TaskType;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
@ -35,6 +37,7 @@ import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.TimeZone;
import java.util.Locale;
public class TestHistoryViewerPrinter {
@ -43,6 +46,18 @@ public class TestHistoryViewerPrinter {
private final String LINE_SEPARATOR = System.lineSeparator();
private static final Locale DEFAULT_LOCALE = Locale.getDefault();
@BeforeClass
public static void setUp() throws Exception {
Locale.setDefault(Locale.ENGLISH);
}
@AfterClass
public static void tearDown() throws Exception {
Locale.setDefault(DEFAULT_LOCALE);
}
@Test
public void testHumanPrinter() throws Exception {
JobHistoryParser.JobInfo job = createJobInfo();