You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/04/28 05:41:15 UTC

[GitHub] [hadoop] aajisaka commented on a diff in pull request #4242: YARN-11116. Migrate Times util from SimpleDateFormat to thread-safe D…

aajisaka commented on code in PR #4242:
URL: https://github.com/apache/hadoop/pull/4242#discussion_r860503837


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestTimes.java:
##########
@@ -61,4 +67,15 @@ public void testFinishTimesAheadOfStartTimes() {
     elapsed = Times.elapsed(Long.MAX_VALUE, 0, true);
     Assert.assertEquals("Elapsed time is not -1", -1, elapsed);
   }
+
+  @Test
+  public void validateISO() throws IOException {
+    SimpleDateFormat isoFormat = new SimpleDateFormat(ISO8601_DATE_FORMAT);
+    for (int i = 0; i < 1000; i++) {
+      long now = System.currentTimeMillis();
+      String instant =  Times.formatISO8601(now);
+      String date = isoFormat.format(new Date(now));
+      Assert.assertEquals(date, instant);

Review Comment:
   The order of the arguments are (expected, actual). I think it should be (instant, date).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org