@Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        Long requestId = (Long) invocation.getArguments()[0];
        for (Stage stage : stages) {
          if (requestId.equals(stage.getRequestId())) {
            for (HostRoleCommand command : stage.getOrderedHostRoleCommands()) {
              if (command.getStatus() == HostRoleStatus.QUEUED
                  || command.getStatus() == HostRoleStatus.IN_PROGRESS
                  || command.getStatus() == HostRoleStatus.PENDING) {
                command.setStatus(HostRoleStatus.ABORTED);
              }
            }
          }
        }

        return null;
      }
Tests that command failures in skippable stages do not cause the request to
be aborted.
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java