@Test
public void testConfigActionUpgradeAcrossStack() throws Exception {

  makeUpgradeCluster();
  Cluster c = clusters.getCluster("c1");
  assertEquals(1, c.getConfigsByType("zoo.cfg").size());
  c.setCurrentStackVersion(HDP_211_STACK);
  c.setDesiredStackVersion(HDP_220_STACK);
  Config config = cf.createNew(c, "zoo.cfg", "version2", new HashMap<String, String>() {{
        put("initLimit", "10");
      }}, new HashMap<String, Map<String,String>>());
  c.addDesiredConfig("user", Collections.singleton(config));
  assertEquals(2, c.getConfigsByType("zoo.cfg").size());
  List<ConfigurationKeyValue> configurations = new ArrayList<>();
  ConfigurationKeyValue keyValue = new ConfigurationKeyValue();
  configurations.add(keyValue);
  keyValue.key = "initLimit";
  keyValue.value = "11";
  Map<String, String> commandParams = new HashMap<>();
  commandParams.put("upgrade_direction", "upgrade");
  commandParams.put("version", HDP_2_2_0_1);
  commandParams.put("clusterName", "c1");
  commandParams.put(ConfigureTask.PARAMETER_CONFIG_TYPE, "zoo.cfg");
  commandParams.put(ConfigureTask.PARAMETER_KEY_VALUE_PAIRS, new Gson().toJson(configurations));
  ExecutionCommand executionCommand = new ExecutionCommand();
  executionCommand.setCommandParams(commandParams);
  executionCommand.setClusterName("c1");
  HostRoleCommand hostRoleCommand = hostRoleCommandFactory.create(null, null,
      null, null);
  hostRoleCommand.setExecutionCommandWrapper(new ExecutionCommandWrapper(
      executionCommand));
  action.setExecutionCommand(executionCommand);
  action.setHostRoleCommand(hostRoleCommand);
  CommandReport report = action.execute(null);
  assertNotNull(report);
  assertEquals(2, c.getConfigsByType("zoo.cfg").size());
  config = c.getDesiredConfigByType("zoo.cfg");
  assertNotNull(config);
  assertEquals("version2", config.getTag());
  assertEquals("11", config.getProperties().get("initLimit"));
}