@Test
public void testMonitoringOperationsWithAutoHaEnabled() throws Exception {

  Mockito.doReturn(STANDBY_READY_RESULT).when(mockProtocol).getServiceStatus();
  // Turn on auto-HA
  HdfsConfiguration conf = getHAConf();
  conf.setBoolean(DFSConfigKeys.DFS_HA_AUTO_FAILOVER_ENABLED_KEY, true);
  tool.setConf(conf);
  assertEquals(0, runTool("-checkHealth", "nn1"));
  Mockito.verify(mockProtocol).monitorHealth();
  
  assertEquals(0, runTool("-getServiceState", "nn1"));
  Mockito.verify(mockProtocol).getServiceStatus();
}