@Test
  public void testSequentialServiceChecks() throws Exception {
    Map<String, UpgradePack> upgrades = ambariMetaInfo.getUpgradePacks("HDP", "2.1.1");
    assertTrue(upgrades.containsKey("upgrade_test_checks"));
    UpgradePack upgrade = upgrades.get("upgrade_test_checks");
    assertNotNull(upgrade);

    Cluster cluster = makeCluster();
    cluster.deleteService("HDFS", new DeleteHostComponentStatusMetaData());
    cluster.deleteService("YARN", new DeleteHostComponentStatusMetaData());

    UpgradeContext context = getMockUpgradeContext(cluster, Direction.UPGRADE,
        UpgradeType.ROLLING, repositoryVersion2110);

    List<UpgradeGroupHolder> groups = m_upgradeHelper.createSequence(upgrade, context);
    assertEquals(5, groups.size());

    UpgradeGroupHolder serviceCheckGroup = groups.get(2);
    assertEquals(ServiceCheckGrouping.class, serviceCheckGroup.groupClass);
    assertEquals(3, serviceCheckGroup.items.size());

    StageWrapper wrapper = serviceCheckGroup.items.get(0);
    assertEquals(ServiceCheckGrouping.ServiceCheckStageWrapper.class, wrapper.getClass());
    assertTrue(wrapper.getText().contains("ZooKeeper"));

    // Do stacks cleanup
    stackManagerMock.invalidateCurrentPaths();
    ambariMetaInfo.init();
  }
Tests merging configurations between existing and new stack values on
upgrade.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeHelperTest.java