[ 
https://issues.apache.org/jira/browse/YARN-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14104661#comment-14104661
 ] 

Tsuyoshi OZAWA commented on YARN-2035:
--------------------------------------

Hi [~jeagles], how about adding tests as follows to cover the scenario by 
adding a helper method like {{initRootPath(fs, path)}} to make FileSystem 
object injectable? 

{code}
  @Test
  public void testInitExistingWorkingDirectoryInSafeMode() throws IOException {
    LOG.info("Starting testInitWorkingDirectoryInSafeMode");
    store.stop();
    doThrow(new IOException("emulating safe mode exception")).when(fs)
        .mkdirs(any(Path.class));

    FileSystemApplicationHistoryStore store
        = new FileSystemApplicationHistoryStore();
    try {
      store.initRootPath(fs, fsWorkingPath);
    } catch (Exception e) {
      Assert.fail("Exception should not be thrown: " + e);
    }
  }

  @Test
  public void testInitNonExistingWorkingDirectoryInSafeMode()
      throws IOException {
    LOG.info("Starting testInitNonExistingWorkingDirectoryInSafeMode");
    store.stop();
    fs.delete(fsWorkingPath, true);
    doThrow(new IOException("emulating safe mode exception")).when(fs)
        .mkdirs(any(Path.class));

    FileSystemApplicationHistoryStore store
        = new FileSystemApplicationHistoryStore();
    try {
      store.initRootPath(fs, fsWorkingPath);
      Assert.fail("Exception should be thrown");
    } catch (Exception e) {
      // expected behavior.
    }
  }
{code}


> FileSystemApplicationHistoryStore blocks RM and AHS while NN is in safemode
> ---------------------------------------------------------------------------
>
>                 Key: YARN-2035
>                 URL: https://issues.apache.org/jira/browse/YARN-2035
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>    Affects Versions: 2.4.1
>            Reporter: Jonathan Eagles
>            Assignee: Jonathan Eagles
>         Attachments: YARN-2035.patch
>
>
> Small bug that prevents ResourceManager and ApplicationHistoryService from 
> coming up while Namenode is in safemode.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to