@Test
  public void startBackupNodeWithIncorrectAuthentication() throws IOException {

  Configuration c = new HdfsConfiguration();
  StartupOption startupOpt = StartupOption.CHECKPOINT;
  String dirs = getBackupNodeDir(startupOpt, 1);
  c.set(DFSConfigKeys.FS_DEFAULT_NAME_KEY,
      "hdfs://127.0.0.1:" + ServerSocketUtil.getPort(0, 100));
  c.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "127.0.0.1:0");
  c.set(DFSConfigKeys.DFS_BLOCKREPORT_INITIAL_DELAY_KEY, "0");
  c.setInt(DFSConfigKeys.DFS_DATANODE_SCAN_PERIOD_HOURS_KEY,
      -1); // disable block scanner
  c.setInt(DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_TXNS_KEY, 1);
  c.set(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY, dirs);
  c.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY,
      "${" + DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY + "}");
  c.set(DFSConfigKeys.DFS_NAMENODE_BACKUP_ADDRESS_KEY,
      "127.0.0.1:0");
  c.set(DFSConfigKeys.DFS_NAMENODE_BACKUP_HTTP_ADDRESS_KEY,
      "127.0.0.1:0");
  NameNode nn;
  try {
    Configuration nnconf = new HdfsConfiguration(c);
    DFSTestUtil.formatNameNode(nnconf);
    nn = NameNode.createNameNode(new String[] {}, nnconf);
  } catch (IOException e) {
    LOG.info("IOException is thrown creating name node");
    throw e;
  }
  c.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
      "kerberos");
  c.set(DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY, "");
  BackupNode bn = null;
  try {
    bn = (BackupNode)NameNode.createNameNode(
        new String[] {startupOpt.getName()}, c);
    assertTrue("Namesystem in BackupNode should be null",
        bn.getNamesystem() == null);
    fail("Incorrect authentication setting should throw IOException");
  } catch (IOException e) {
    LOG.info("IOException thrown.", e);
    assertTrue(e.getMessage().contains("Running in secure mode"));
  } finally {
    if (nn != null) {
      nn.stop();
    }
    if (bn != null) {
      bn.stop();
    }
    SecurityUtil.setAuthenticationMethod(
        UserGroupInformation.AuthenticationMethod.SIMPLE, c);
    // reset security authentication
    UserGroupInformation.setConfiguration(c);
  }
}