Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-5622

TestYarnCLI.testGetContainers fails due to mismatched date formats

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha2
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      ApplicationCLI.listContainers uses Times.format to print timestamps, while TestYarnCLI.testGetContainers formats them using dateFormat.format with its own defined format. The test should be consistent and use Times.format.

      org.junit.ComparisonFailure: expected:<...1234_0005_01_000001	[Thu Jan 01 00:00:01 +0000 1970	Thu Jan 01 00:00:05 +0000 1970	            COMPLETE	           host:1234	    http://host:2345	                             logURL
       container_1234_0005_01_000002	Thu Jan 01 00:00:01 +0000 1970	Thu Jan 01 00:00:05 +0000 1970	            COMPLETE	           host:1234	    http://host:2345	                             logURL
       container_1234_0005_01_000003	Thu Jan 01 00:00:01 +0000 1970]	                 N/...> but was:<...1234_0005_01_000001	[ 1-Jan-1970 00:00:01	 1-Jan-1970 00:00:05	            COMPLETE	           host:1234	    http://host:2345	                             logURL
       container_1234_0005_01_000002	 1-Jan-1970 00:00:01	 1-Jan-1970 00:00:05	            COMPLETE	           host:1234	    http://host:2345	                             logURL
       container_1234_0005_01_000003	 1-Jan-1970 00:00:01]	                 N/...>
      	at org.junit.Assert.assertEquals(Assert.java:115)
      	at org.junit.Assert.assertEquals(Assert.java:144)
      	at org.apache.hadoop.yarn.client.cli.TestYarnCLI.testGetContainers(TestYarnCLI.java:330)
      

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10480 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10480/)
        YARN-5622. TestYarnCLI.testGetContainers fails due to mismatched date (kihwal: rev 6e849cb658438c0561de485e01f3de7df47bf9ad)

        • (edit) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10480 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10480/ ) YARN-5622 . TestYarnCLI.testGetContainers fails due to mismatched date (kihwal: rev 6e849cb658438c0561de485e01f3de7df47bf9ad) (edit) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java
        Hide
        kihwal Kihwal Lee added a comment -

        Committed to trunk, branch-2 and branch-2.8. Thanks, Eric for fixing it and Akira for the review.

        Show
        kihwal Kihwal Lee added a comment - Committed to trunk, branch-2 and branch-2.8. Thanks, Eric for fixing it and Akira for the review.
        Hide
        ajisakaa Akira Ajisaka added a comment -

        Thank you for the detailed information. +1 for the improvement.

        Show
        ajisakaa Akira Ajisaka added a comment - Thank you for the detailed information. +1 for the improvement.
        Hide
        ebadger Eric Badger added a comment -

        Akira Ajisaka, it doesn't currently fail in trunk because the dateFormat used in this test is currently consistent with the format defined in Times.format(). But we aren't testing that the date format is one way or the other, we're just checking to make sure that the dates are consistent. It's unnecessary to maintain the consistency between this test's hardcoded dateFormat and the one defined in Times. So we could mark this as an improvement rather than a bug fix as the test is not actually failing at this moment. But the improvement is still valid.

        Currently in trunk:

        TestYarnCLI.java

        303     DateFormat dateFormat=new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");
        

        Times.java

         33   static final ThreadLocal<SimpleDateFormat> dateFormat =
         34       new ThreadLocal<SimpleDateFormat>() {
         35         @Override protected SimpleDateFormat initialValue() {
         36           return new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");
         37         }
         38       };
        
        Show
        ebadger Eric Badger added a comment - Akira Ajisaka , it doesn't currently fail in trunk because the dateFormat used in this test is currently consistent with the format defined in Times.format(). But we aren't testing that the date format is one way or the other, we're just checking to make sure that the dates are consistent. It's unnecessary to maintain the consistency between this test's hardcoded dateFormat and the one defined in Times. So we could mark this as an improvement rather than a bug fix as the test is not actually failing at this moment. But the improvement is still valid. Currently in trunk: TestYarnCLI.java 303 DateFormat dateFormat=new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy"); Times.java 33 static final ThreadLocal<SimpleDateFormat> dateFormat = 34 new ThreadLocal<SimpleDateFormat>() { 35 @Override protected SimpleDateFormat initialValue() { 36 return new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy"); 37 } 38 };
        Hide
        ajisakaa Akira Ajisaka added a comment -

        I couldn't reproduce the failure. Does this issue still occur on the latest trunk?

        Show
        ajisakaa Akira Ajisaka added a comment - I couldn't reproduce the failure. Does this issue still occur on the latest trunk?
        Hide
        hadoopqa Hadoop QA added a comment -
        +1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 18s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 test4tests 0m 0s The patch appears to include 1 new or modified test files.
        +1 mvninstall 6m 45s trunk passed
        +1 compile 0m 20s trunk passed
        +1 checkstyle 0m 16s trunk passed
        +1 mvnsite 0m 25s trunk passed
        +1 mvneclipse 0m 14s trunk passed
        +1 findbugs 0m 28s trunk passed
        +1 javadoc 0m 15s trunk passed
        +1 mvninstall 0m 19s the patch passed
        +1 compile 0m 17s the patch passed
        +1 javac 0m 17s the patch passed
        +1 checkstyle 0m 13s the patch passed
        +1 mvnsite 0m 22s the patch passed
        +1 mvneclipse 0m 12s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 findbugs 0m 33s the patch passed
        +1 javadoc 0m 11s the patch passed
        +1 unit 15m 55s hadoop-yarn-client in the patch passed.
        +1 asflicense 0m 14s The patch does not generate ASF License warnings.
        27m 56s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:9560f25
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12827427/YARN-5622.001.patch
        JIRA Issue YARN-5622
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux caf7aec27c64 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / f414d5e
        Default Java 1.8.0_101
        findbugs v3.0.0
        Test Results https://builds.apache.org/job/PreCommit-YARN-Build/13037/testReport/
        modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client
        Console output https://builds.apache.org/job/PreCommit-YARN-Build/13037/console
        Powered by Apache Yetus 0.3.0 http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 reexec 0m 18s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 1 new or modified test files. +1 mvninstall 6m 45s trunk passed +1 compile 0m 20s trunk passed +1 checkstyle 0m 16s trunk passed +1 mvnsite 0m 25s trunk passed +1 mvneclipse 0m 14s trunk passed +1 findbugs 0m 28s trunk passed +1 javadoc 0m 15s trunk passed +1 mvninstall 0m 19s the patch passed +1 compile 0m 17s the patch passed +1 javac 0m 17s the patch passed +1 checkstyle 0m 13s the patch passed +1 mvnsite 0m 22s the patch passed +1 mvneclipse 0m 12s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 0m 33s the patch passed +1 javadoc 0m 11s the patch passed +1 unit 15m 55s hadoop-yarn-client in the patch passed. +1 asflicense 0m 14s The patch does not generate ASF License warnings. 27m 56s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12827427/YARN-5622.001.patch JIRA Issue YARN-5622 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux caf7aec27c64 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / f414d5e Default Java 1.8.0_101 findbugs v3.0.0 Test Results https://builds.apache.org/job/PreCommit-YARN-Build/13037/testReport/ modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client Console output https://builds.apache.org/job/PreCommit-YARN-Build/13037/console Powered by Apache Yetus 0.3.0 http://yetus.apache.org This message was automatically generated.
        Hide
        ebadger Eric Badger added a comment -

        Attaching patches that uses Times.format() in TestYarnCLI.testGetContainers instead of dateFormat.format().

        Show
        ebadger Eric Badger added a comment - Attaching patches that uses Times.format() in TestYarnCLI.testGetContainers instead of dateFormat.format().

          People

          • Assignee:
            ebadger Eric Badger
            Reporter:
            ebadger Eric Badger
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development