Browse Source

AMBARI-8661. Distribute Repositories/Install Components - fix missing INSTALLING->INSTALL_FAILED transition on multinode cluster (dlysnichenko)

Lisnichenko Dmitro 10 years ago
parent
commit
4e04189d70

+ 4 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java

@@ -1263,8 +1263,11 @@ public class ClusterImpl implements Cluster {
             throw new AmbariException(String.format("Repo version %s is not installed on host %s",
                     repositoryVersion, hostName));
           }
-          if (hostVersion.getState() != worstState) {
+          if (hostVersion.getState() == RepositoryVersionState.INSTALL_FAILED) {
             worstState = hostVersion.getState();
+            break;
+          } else if (hostVersion.getState() == RepositoryVersionState.INSTALLING) {
+            worstState = RepositoryVersionState.INSTALLING;
           }
         }
         if (worstState != clusterVersion.getState()) {

+ 3 - 4
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java

@@ -263,7 +263,6 @@ public class TestActionScheduler {
 
   }
 
-  @Ignore
   @Test
   public void testActionTimeoutForLostHost() throws Exception {
     ActionQueue aq = new ActionQueue();
@@ -314,9 +313,10 @@ public class TestActionScheduler {
     }).when(db).timeoutHostRole(anyString(), anyLong(), anyLong(), anyString());
 
     //Small action timeout to test rescheduling
+    AmbariEventPublisher aep = EasyMock.createNiceMock(AmbariEventPublisher.class);
     ActionScheduler scheduler = EasyMock.createMockBuilder(ActionScheduler.class).
         withConstructor((long) 100, (long) 50, db, aq, fsm, 3,
-            new HostsMap((String) null), unitOfWork, EasyMock.anyObject(AmbariEventPublisher.class), null, conf).
+            new HostsMap((String) null), unitOfWork, aep, conf).
         addMockedMethod("cancelHostRoleCommands").
         createMock();
     scheduler.cancelHostRoleCommands((Collection<HostRoleCommand>)EasyMock.anyObject(),EasyMock.anyObject(String.class));
@@ -1006,7 +1006,6 @@ public class TestActionScheduler {
     Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(1).getHostRoleStatus(hostname1, "GANGLIA_MONITOR"));
   }
 
-  @Ignore
   @Test
   public void testRequestFailureOnStageFailure() throws Exception {
     ActionQueue aq = new ActionQueue();
@@ -1116,7 +1115,7 @@ public class TestActionScheduler {
     ActionScheduler scheduler = EasyMock.createMockBuilder(ActionScheduler.class).
         withConstructor((long)100, (long)50, db, aq, fsm, 3,
           new HostsMap((String) null),
-          unitOfWork, null, conf).
+          unitOfWork, EasyMock.createNiceMock(AmbariEventPublisher.class), conf).
           addMockedMethod("cancelHostRoleCommands").
           createMock();
     scheduler.cancelHostRoleCommands(EasyMock.capture(cancelCommandList),

+ 2 - 2
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProviderTest.java

@@ -64,7 +64,6 @@ import org.apache.ambari.server.state.StackInfo;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -140,7 +139,6 @@ public class ClusterStackVersionResourceProviderTest {
     injector.getInstance(PersistService.class).stop();
   }
 
-  @Ignore
   @Test
   public void testCreateResources() throws Exception {
     Resource.Type type = Resource.Type.ClusterStackVersion;
@@ -224,6 +222,8 @@ public class ClusterStackVersionResourceProviderTest {
     // add properties to the request map
     properties.put(ClusterStackVersionResourceProvider.CLUSTER_STACK_VERSION_CLUSTER_NAME_PROPERTY_ID, "Cluster100");
     properties.put(ClusterStackVersionResourceProvider.CLUSTER_STACK_VERSION_REPOSITORY_VERSION_PROPERTY_ID, "2.2.0.1-885");
+    properties.put(ClusterStackVersionResourceProvider.CLUSTER_STACK_VERSION_STACK_PROPERTY_ID, "HDP");
+    properties.put(ClusterStackVersionResourceProvider.CLUSTER_STACK_VERSION_VERSION_PROPERTY_ID, "2.0.7");
 
     propertySet.add(properties);