@Test
  public void testFinalizeDowngrade() throws Exception {
    makeDowngradeCluster(repositoryVersion2110, repositoryVersion2111);

    Cluster cluster = clusters.getCluster(clusterName);

    createUpgrade(cluster, repositoryVersion2111);

    Map<String, String> commandParams = new HashMap<>();
    ExecutionCommand executionCommand = new ExecutionCommand();
    executionCommand.setCommandParams(commandParams);
    executionCommand.setClusterName(clusterName);

    HostRoleCommand hostRoleCommand = hostRoleCommandFactory.create(null, null, null, null);
    hostRoleCommand.setExecutionCommandWrapper(new ExecutionCommandWrapper(executionCommand));

    finalizeUpgradeAction.setExecutionCommand(executionCommand);
    finalizeUpgradeAction.setHostRoleCommand(hostRoleCommand);

    CommandReport report = finalizeUpgradeAction.execute(null);
    assertNotNull(report);
    assertEquals(HostRoleStatus.COMPLETED.name(), report.getStatus());

    for (HostVersionEntity entity : hostVersionDAO.findByClusterAndHost(clusterName, "h1")) {
      if (StringUtils.equals(entity.getRepositoryVersion().getVersion(), repositoryVersion2110.getVersion())) {
        assertEquals(RepositoryVersionState.CURRENT, entity.getState());
      } else {
        assertEquals(RepositoryVersionState.INSTALLED, entity.getState());
      }
    }
  }
During an Express Upgrade that crosses a stack version, Ambari calls UpdateDesiredRepositoryAction
in order to change the stack and apply configs.
The configs that are applied must be saved with the username that is passed in the role params.
ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java