[
https://issues.apache.org/jira/browse/MAPREDUCE-7459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17780082#comment-17780082
]
ASF GitHub Bot commented on MAPREDUCE-7459:
-------------------------------------------
goiri commented on code in PR #6215:
URL: https://github.com/apache/hadoop/pull/6215#discussion_r1373775771
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/jobhistory/TestHistoryViewerPrinter.java:
##########
@@ -160,6 +162,10 @@ public void testHumanPrinter() throws Exception {
LINE_SEPARATOR, outStr);
}
+ private void compareStrings(String str1, String str2) {
+
Assertions.assertThat(Arrays.asList(str1.trim().split("\n"))).containsExactlyInAnyOrderElementsOf(Arrays.asList(str2.trim().split("\n")));
Review Comment:
* This could be made a little more readable by extracting the two chunks.
* Make the strings final.
* Name the method something like assertEqualLines().
* Make method static.
> Sort strings to fix flaky test
> ------------------------------
>
> Key: MAPREDUCE-7459
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-7459
> Project: Hadoop Map/Reduce
> Issue Type: Bug
> Components: test
> Affects Versions: 3.3.6
> Environment: Java version: openjdk 11.0.20.1
> Maven version: Apache Maven 3.6.3
> Reporter: Rajiv Ramachandran
> Priority: Minor
> Labels: pull-request-available
> Fix For: 3.3.6
>
>
> The test
> {{_org.apache.hadoop.mapreduce.jobhistory.TestHistoryViewerPrinter#testHumanPrinterAll_}}
> can fail due to flakiness. These flakiness occurs because the test utilizes
> Hashmaps values and converts the values to string to perform the comparision
> and the order of the objects returned may not be necessarily maintained.
> The stack trace is as follows:
> testHumanPrinterAll(org.apache.hadoop.mapreduce.jobhistory.TestHistoryViewerPrinter)
> Time elapsed: 0.297 s <<< FAILURE!
> org.junit.ComparisonFailure:
> expected:<...8501754_0001_m_00000[7 6-Oct-2011 19:15:09 6-Oct-2011
> 19:15:16 (7sec)
> SUCCEEDED MAP task list for job_1317928501754_0001
> TaskId StartTime FinishTime Error InputSplits
> ====================================================
> task_1317928501754_0001_m_000006 6-Oct-2011 19:15:08 6-Oct-2011
> 19:15:14 (6sec)
> ...
> /tasklog?attemptid=attempt_1317928501754_0001_m_000003]_1
> REDUCE task list...> but was:<...8501754_0001_m_00000[5 6-Oct-2011
> 19:15:07 6-Oct-2011 19:15:12 (5sec)
> SUCCEEDED MAP task list for job_1317928501754_0001
> TaskId StartTime FinishTime Error InputSplits
> ====================================================
> task_1317928501754_0001_m_000006 6-Oct-2011 19:15:08 6-Oct-2011
> 19:15:14 (6sec)
> SUCCEEDED MAP task list for job_1317928501754_0001
> TaskId StartTime FinishTime Error InputSplits
> ====================================================
> task_1317928501754_0001_m_000004 6-Oct-2011 19:15:06 6-Oct-2011
> 19:15:10 (4sec)
> SUCCEEDED MAP task list for job_1317928501754_0001
> TaskId StartTime FinishTime Error InputSplits
> ====================================================
> task_1317928501754_0001_m_000007 6-Oct-2011 19:15:09 6-Oct-2011
> 19:15:16 (7sec)
> ...
> /tasklog?attemptid=attempt_1317928501754_0001_m_000006]_1
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]