You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2015/08/20 05:50:51 UTC
ambari git commit: AMBARI-12821: [PluggableStackDefinition] RU:
Pre-req checks while performing upgrade fail with 'Reason: Unexpected server
error happened' (jluniya)
Repository: ambari
Updated Branches:
refs/heads/trunk 1b803c570 -> 25237d3fe
AMBARI-12821: [PluggableStackDefinition] RU: Pre-req checks while performing upgrade fail with 'Reason: Unexpected server error happened' (jluniya)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/25237d3f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/25237d3f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/25237d3f
Branch: refs/heads/trunk
Commit: 25237d3fe11bc0bd436d20774a4371d7794f7725
Parents: 1b803c5
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Wed Aug 19 20:50:45 2015 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Wed Aug 19 20:50:45 2015 -0700
----------------------------------------------------------------------
.../pluggable_stack_definition/configs/PHD.json | 3 ++-
ambari-server/conf/unix/ambari.properties | 3 +++
.../server/checks/AbstractCheckDescriptor.java | 27 ++++++++++++++------
.../server/configuration/Configuration.java | 12 +++++++++
.../checks/ClientRetryPropertyCheckTest.java | 5 ++++
.../checks/ConfigurationMergeCheckTest.java | 7 +++++
.../HiveDynamicServiceDiscoveryCheckTest.java | 5 ++++
.../checks/HiveMultipleMetastoreCheckTest.java | 5 ++++
.../server/checks/HostsHeartbeatCheckTest.java | 8 +++++-
.../checks/HostsMasterMaintenanceCheckTest.java | 12 +++++++--
.../checks/HostsRepositoryVersionCheckTest.java | 12 +++++++--
...duce2JobHistoryStatePreservingCheckTest.java | 7 ++++-
.../SecondaryNamenodeDeletedCheckTest.java | 5 ++++
.../ServicesMaintenanceModeCheckTest.java | 8 +++++-
...vicesMapReduceDistributedCacheCheckTest.java | 5 ++++
...rvicesNamenodeHighAvailabilityCheckTest.java | 5 ++++
.../ServicesNamenodeTruncateCheckTest.java | 7 +++++
.../ServicesTezDistributedCacheCheckTest.java | 6 +++++
.../server/checks/ServicesUpCheckTest.java | 8 +++++-
.../ServicesYarnWorkPreservingCheckTest.java | 5 ++++
...nTimelineServerStatePreservingCheckTest.java | 5 ++++
.../ambari/server/state/CheckHelperTest.java | 5 ++++
22 files changed, 148 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-common/src/main/python/pluggable_stack_definition/configs/PHD.json
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/pluggable_stack_definition/configs/PHD.json b/ambari-common/src/main/python/pluggable_stack_definition/configs/PHD.json
index 88ce152..c58c830 100644
--- a/ambari-common/src/main/python/pluggable_stack_definition/configs/PHD.json
+++ b/ambari-common/src/main/python/pluggable_stack_definition/configs/PHD.json
@@ -19,7 +19,8 @@
"jdk1.7.url" : "http://DOWNLOAD_NOT_SUPPORTED",
"jdk1.8.url" : "http://DOWNLOAD_NOT_SUPPORTED",
"jdk1.7.jcpol-url" : "http://DOWNLOAD_NOT_SUPPORTED",
- "jdk1.8.jcpol-url" : "http://DOWNLOAD_NOT_SUPPORTED"
+ "jdk1.8.jcpol-url" : "http://DOWNLOAD_NOT_SUPPORTED",
+ "rolling.upgrade.min.stack" : "PHD-3.0"
},
"versions": [
{
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index d409d77..75e0fe1 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -89,3 +89,6 @@ server.http.session.inactive_timeout=1800
# to skip service checks during deploy
skip.service.checks=false
+
+rolling.upgrade.min.stack=HDP-2.2
+rolling.upgrade.max.stack=
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
index 44cec85..2f0bc94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
@@ -23,6 +23,7 @@ import java.util.Map;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.orm.dao.HostVersionDAO;
import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
import org.apache.ambari.server.state.Cluster;
@@ -47,8 +48,6 @@ import com.google.inject.Provider;
public abstract class AbstractCheckDescriptor {
private static final Logger LOG = LoggerFactory.getLogger(AbstractCheckDescriptor.class);
- protected static final StackId STACK_HDP_22 = new StackId("HDP", "2.2");
- protected static final StackId STACK_HDP_23 = new StackId("HDP", "2.3");
protected static final String DEFAULT = "default";
@@ -67,6 +66,9 @@ public abstract class AbstractCheckDescriptor {
@Inject
Provider<AmbariMetaInfo> ambariMetaInfo;
+ @Inject
+ Configuration config;
+
private CheckDescription m_description;
/**
@@ -116,27 +118,36 @@ public abstract class AbstractCheckDescriptor {
/**
* Gets the earliest stack that the upgrade check is compatible with. By
- * default, all checks will return {@link #STACK_HDP_22} since this is the
- * first version of HDP that supports automated upgrades.
+ * default, all checks will return rolling.upgrade.min.stack since this is the
+ * first stack version that supports automated upgrades.
*
* @return the earliest stack that the upgrade check is compatible with, or
* {@code null} for all.
*/
public StackId getSourceStack(){
- return STACK_HDP_22;
+ String minStackId = config.getRollingUpgradeMinStack();
+ if(minStackId == null || minStackId.isEmpty()) {
+ return null;
+ }
+ return new StackId(minStackId);
}
/**
* Gets the most recent stack that the upgrade check is compatible with. By
- * default, this will return {@code null} to indicate all future stacks are
- * compatible. If an upgrade check is not compatible with a future stack, then
+ * default, this will return rolling.upgrade.max.stack, which is typically
+ * set to null to indicate all future stacks are compatible.
+ * If an upgrade check is not compatible with a future stack, then
* this method should be overridden.
*
* @return the most recent stack that the upgrade check is compatible with, or
* {@code null} for all.
*/
public StackId getTargetStack() {
- return null;
+ String maxStackId = config.getRollingUpgradeMaxStack();
+ if(maxStackId == null || maxStackId.isEmpty()) {
+ return null;
+ }
+ return new StackId(maxStackId);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 23291bc..08c835f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -172,6 +172,10 @@ public class Configuration {
public static final String SERVER_JDBC_DRIVER_KEY = "server.jdbc.driver";
public static final String SERVER_JDBC_URL_KEY = "server.jdbc.url";
public static final String SERVER_JDBC_PROPERTIES_PREFIX = "server.jdbc.properties.";
+ public static final String ROLLING_UPGRADE_MIN_STACK_KEY = "rolling.upgrade.min.stack";
+ public static final String ROLLING_UPGRADE_MAX_STACK_KEY = "rolling.upgrade.max.stack";
+ public static final String ROLLING_UPGRADE_MIN_STACK_DEFAULT = "HDP-2.2";
+ public static final String ROLLING_UPGRADE_MAX_STACK_DEFAULT = "";
public static final String SERVER_JDBC_CONNECTION_POOL = "server.jdbc.connection-pool";
public static final String SERVER_JDBC_CONNECTION_POOL_MIN_SIZE = "server.jdbc.connection-pool.min-size";
@@ -864,6 +868,14 @@ public class Configuration {
return properties.getProperty(STACK_ADVISOR_SCRIPT, STACK_ADVISOR_SCRIPT_DEFAULT);
}
+ public String getRollingUpgradeMinStack() {
+ return properties.getProperty(ROLLING_UPGRADE_MIN_STACK_KEY, ROLLING_UPGRADE_MIN_STACK_DEFAULT);
+ }
+
+ public String getRollingUpgradeMaxStack() {
+ return properties.getProperty(ROLLING_UPGRADE_MAX_STACK_KEY, ROLLING_UPGRADE_MAX_STACK_DEFAULT);
+ }
+
/**
* Get the map with server config parameters.
* Keys - public constants of this class
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
index 20242ec..6221112 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.checks;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -55,6 +56,10 @@ public class ClientRetryPropertyCheckTest {
return m_clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ m_check.config = config;
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
index 2e2bf3d..44bf164 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
@@ -88,6 +89,12 @@ public class ConfigurationMergeCheckTest {
request.setTargetStackId(stackId_1_0);
ConfigurationMergeCheck cmc = new ConfigurationMergeCheck();
+ Configuration config = EasyMock.createMock(Configuration.class);
+ expect(config.getRollingUpgradeMinStack()).andReturn("HDP-2.2").anyTimes();
+ expect(config.getRollingUpgradeMaxStack()).andReturn("").anyTimes();
+ replay(config);
+ cmc.config = config;
+
Assert.assertFalse(cmc.isApplicable(request));
final RepositoryVersionDAO repositoryVersionDAO = EasyMock.createMock(RepositoryVersionDAO.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
index e4b3438..b4bec49 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.checks;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -55,6 +56,10 @@ public class HiveDynamicServiceDiscoveryCheckTest {
return m_clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ m_check.config = config;
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
index c74277c..263ec1f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -55,6 +56,10 @@ public class HiveMultipleMetastoreCheckTest {
return m_clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ m_check.config = config;
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
index d9f7242..5f6cae9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.checks;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -49,8 +50,13 @@ public class HostsHeartbeatCheckTest {
checkRequest.setRepositoryVersion("HDP-2.2.0.0");
checkRequest.setSourceStackId(new StackId("HDP", "2.2"));
checkRequest.setTargetStackId(new StackId("HDP", "2.2"));
+ HostsHeartbeatCheck hhc = new HostsHeartbeatCheck();
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ hhc.config = config;
- Assert.assertTrue(new HostsHeartbeatCheck().isApplicable(checkRequest));
+ Assert.assertTrue(hhc.isApplicable(checkRequest));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
index fc0f9bc..961c28d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
import org.apache.ambari.server.state.Cluster;
@@ -53,10 +54,17 @@ public class HostsMasterMaintenanceCheckTest {
public void testIsApplicable() throws Exception {
final PrereqCheckRequest request = new PrereqCheckRequest("cluster");
request.setRepositoryVersion("not null");
- Assert.assertTrue(new HostsMasterMaintenanceCheck().isApplicable(request));
+ HostsMasterMaintenanceCheck hmmc = new HostsMasterMaintenanceCheck();
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ hmmc.config = config;
+ Assert.assertTrue(hmmc.isApplicable(request));
request.setRepositoryVersion(null);
- Assert.assertFalse(new HostsMasterMaintenanceCheck().isApplicable(request));
+ HostsMasterMaintenanceCheck hmmc2 = new HostsMasterMaintenanceCheck();
+ hmmc2.config = config;
+ Assert.assertFalse(hmmc2.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
index c6c7e54..b54b633 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
@@ -21,6 +21,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.dao.HostVersionDAO;
import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
@@ -54,10 +55,17 @@ public class HostsRepositoryVersionCheckTest {
public void testIsApplicable() throws Exception {
final PrereqCheckRequest request = new PrereqCheckRequest("cluster");
request.setRepositoryVersion("not null");
- Assert.assertTrue(new HostsMasterMaintenanceCheck().isApplicable(request));
+ HostsRepositoryVersionCheck hrvc = new HostsRepositoryVersionCheck();
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ hrvc.config = config;
+ Assert.assertTrue(hrvc.isApplicable(request));
request.setRepositoryVersion(null);
- Assert.assertFalse(new HostsMasterMaintenanceCheck().isApplicable(request));
+ HostsRepositoryVersionCheck hrvc2 = new HostsRepositoryVersionCheck();
+ hrvc2.config = config;
+ Assert.assertFalse(hrvc2.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
index 7ec3a3a..c1b57fb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
@@ -18,6 +18,7 @@
package org.apache.ambari.server.checks;
import com.google.inject.Provider;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
@@ -57,6 +58,10 @@ public class MapReduce2JobHistoryStatePreservingCheckTest {
return m_clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ m_check.config = config;
}
/**
@@ -156,7 +161,7 @@ public class MapReduce2JobHistoryStatePreservingCheckTest {
Mockito.when(m_clusters.getCluster("c1")).thenReturn(cluster);
PrereqCheckRequest request = new PrereqCheckRequest("c1");
- Mockito.when(repositoryVersionEntity.getVersion()).thenReturn("2.2.0.1");
+ Mockito.when(repositoryVersionEntity.getVersion()).thenReturn("2.0.0.1");
boolean isApplicable = m_check.isApplicable(request);
Assert.assertTrue(isApplicable);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
index 631ca8a..5d32f4d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
@@ -21,6 +21,7 @@ import java.util.Collections;
import org.apache.ambari.server.ServiceNotFoundException;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
import org.apache.ambari.server.state.Cluster;
@@ -64,6 +65,10 @@ public class SecondaryNamenodeDeletedCheckTest {
};
secondaryNamenodeDeletedCheck.hostComponentStateDao = hostComponentStateDAO;
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ secondaryNamenodeDeletedCheck.config = config;
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
index 87ced01..0eb3ace 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.checks;
import java.util.Collections;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -48,7 +49,12 @@ public class ServicesMaintenanceModeCheckTest {
checkRequest.setSourceStackId(new StackId("HDP", "2.2"));
checkRequest.setTargetStackId(new StackId("HDP", "2.2"));
- Assert.assertTrue(new ServicesMaintenanceModeCheck().isApplicable(checkRequest));
+ ServicesMaintenanceModeCheck smmc = new ServicesMaintenanceModeCheck();
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ smmc.config = config;
+ Assert.assertTrue(smmc.isApplicable(checkRequest));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
index acc9776..fea82f3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.ServiceNotFoundException;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -54,6 +55,10 @@ public class ServicesMapReduceDistributedCacheCheckTest {
return clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ servicesMapReduceDistributedCacheCheck.config = config;
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
index 85ebc79..947121a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.ServiceNotFoundException;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -55,6 +56,10 @@ public class ServicesNamenodeHighAvailabilityCheckTest {
return clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ servicesNamenodeHighAvailabilityCheck.config = config;
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
index b83f26c..07d17d8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -63,6 +64,12 @@ public class ServicesNamenodeTruncateCheckTest {
replay(m_clusters, cluster, config);
+ Configuration configuration = EasyMock.createMock(Configuration.class);
+ expect(configuration.getRollingUpgradeMinStack()).andReturn("HDP-2.2").anyTimes();
+ expect(configuration.getRollingUpgradeMaxStack()).andReturn("").anyTimes();
+ replay(configuration);
+ m_check.config = configuration;
+
m_check.clustersProvider = new Provider<Clusters>() {
@Override
public Clusters get() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
index 88584f7..d732302 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.ServiceNotFoundException;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -54,6 +55,11 @@ public class ServicesTezDistributedCacheCheckTest {
return clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ servicesTezDistributedCacheCheck.config = config;
+
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
index 38a41ef..38b4374 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.models.HostComponentSummary;
import org.apache.ambari.server.state.Cluster;
@@ -64,8 +65,13 @@ public class ServicesUpCheckTest {
checkRequest.setRepositoryVersion("HDP-2.2.0.0");
checkRequest.setSourceStackId(new StackId("HDP", "2.2"));
checkRequest.setTargetStackId(new StackId("HDP", "2.2"));
+ ServicesUpCheck suc = new ServicesUpCheck();
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ suc.config = config;
- Assert.assertTrue(new ServicesUpCheck().isApplicable(checkRequest));
+ Assert.assertTrue(suc.isApplicable(checkRequest));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
index 721320d..135c9c9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.ServiceNotFoundException;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -55,6 +56,10 @@ public class ServicesYarnWorkPreservingCheckTest {
return clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ servicesYarnWorkPreservingCheck.config = config;
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
index 1a10db7..06e0b11 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.checks;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
@@ -58,6 +59,10 @@ public class YarnTimelineServerStatePreservingCheckTest {
return m_clusters;
}
};
+ Configuration config = Mockito.mock(Configuration.class);
+ Mockito.when(config.getRollingUpgradeMinStack()).thenReturn("HDP-2.2");
+ Mockito.when(config.getRollingUpgradeMaxStack()).thenReturn("");
+ m_check.config = config;
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/25237d3f/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
index e3836cb..7668545 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
@@ -29,9 +29,11 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.checks.AbstractCheckDescriptor;
import org.apache.ambari.server.checks.CheckDescription;
import org.apache.ambari.server.checks.ServicesUpCheck;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.dao.HostVersionDAO;
import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.state.stack.OsFamily;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
@@ -116,6 +118,8 @@ public class CheckHelperTest {
}
});
+ final OsFamily osFamily = Mockito.mock(OsFamily.class);
+
final Injector injector = Guice.createInjector(new AbstractModule() {
@Override
@@ -126,6 +130,7 @@ public class CheckHelperTest {
bind(RepositoryVersionHelper.class).toProvider(Providers.<RepositoryVersionHelper>of(null));
bind(AmbariMetaInfo.class).toProvider(Providers.<AmbariMetaInfo>of(null));
bind(ServicesUpCheck.class).toInstance(new ServicesUpCheck());
+ bind(OsFamily.class).toInstance(osFamily);
}
});