@Test
  public void testIsTopologyRefreshRequired() throws Exception {
    AmbariCustomCommandExecutionHelper helper = injector.getInstance(AmbariCustomCommandExecutionHelper.class);

    EasyMock.expect(configHelper.getHostActualConfigs(EasyMock.anyLong())).andReturn(
        new AgentConfigsUpdateEvent(null, new TreeMap<>())).anyTimes();

    EasyMock.replay(configHelper);

    createClusterFixture("c2", new StackId("HDP-2.1.1"), "2.1.1.0-1234", "c2");

    EasyMock.verify(configHelper);

    Assert.assertTrue(helper.isTopologyRefreshRequired("START", "c2", "HDFS"));
    Assert.assertTrue(helper.isTopologyRefreshRequired("RESTART", "c2", "HDFS"));
    Assert.assertFalse(helper.isTopologyRefreshRequired("STOP", "c2", "HDFS"));
  }
Perform a Service Check for ZOOKEEPER/ZOOKEEPER_CLIENT without specifying a host to run in the request.
This should cause Ambari to randomly pick one of the ZOOKEEPER_CLIENT hosts.
The current logic first excludes hosts in maintenance mode or that are not healthy (i.e., not heartbeating).
From that candidate list, if any hosts have 0 IN-PROGRESS tasks, it randomly picks from that set.
Otherwise, it picks from all candidate hosts.
@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java