This is an automated email from the ASF dual-hosted git repository.
mpapirkovskyy pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.6 by this push:
new a152b8d AMBARI-25264. Service checks mentioned in HOU upgrade plan
are run on the same node that was upgraded. (mpapirkovskyy) (#2945)
a152b8d is described below
commit a152b8debeb7dcc8f9a82394881881f301980478
Author: Myroslav Papirkovskyi <[email protected]>
AuthorDate: Mon Apr 22 16:16:06 2019 +0300
AMBARI-25264. Service checks mentioned in HOU upgrade plan are run on the
same node that was upgraded. (mpapirkovskyy) (#2945)
---
.../AmbariCustomCommandExecutionHelper.java | 86 +++++++++++-----------
.../internal/UpgradeResourceProvider.java | 2 +-
.../ambari/server/state/ServiceComponent.java | 2 +
.../ambari/server/state/ServiceComponentImpl.java | 9 +++
.../apache/ambari/server/state/UpgradeContext.java | 6 +-
.../ambari/server/state/cluster/ClusterImpl.java | 14 ++++
.../state/stack/upgrade/HostOrderGrouping.java | 25 ++++---
.../server/state/stack/upgrade/HostOrderItem.java | 30 ++++++--
.../internal/UpgradeResourceProviderTest.java | 63 ++++++++++++++++
.../ambari/server/state/UpgradeHelperTest.java | 13 ++--
10 files changed, 180 insertions(+), 70 deletions(-)
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 06c3b04..dc3b08c 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -100,6 +100,7 @@ import org.apache.ambari.server.state.stack.OsFamily;
import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
import
org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpInProgressEvent;
import org.apache.ambari.server.utils.StageUtils;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.slf4j.Logger;
@@ -553,62 +554,33 @@ public class AmbariCustomCommandExecutionHelper {
smokeTestRole = actionExecutionContext.getActionName();
}
- Set<String> candidateHosts;
- final Map<String, ServiceComponentHost> serviceHostComponents;
+ Map<String, Host> componentHosts = new HashMap<>();
+ // get hosts for specified component if it is defined otherwise use hosts
for all components from service
if (componentName != null) {
- serviceHostComponents =
cluster.getService(serviceName).getServiceComponent(componentName).getServiceComponentHosts();
-
- if (serviceHostComponents.isEmpty()) {
- throw new AmbariException(MessageFormat.format("No hosts found for
service: {0}, component: {1} in cluster: {2}",
- serviceName, componentName, clusterName));
- }
-
- // If specified a specific host, run on it as long as it contains the
component.
- // Otherwise, use candidates that contain the component.
- List<String> candidateHostsList = resourceFilter.getHostNames();
- if (candidateHostsList != null && !candidateHostsList.isEmpty()) {
- candidateHosts = new HashSet<>(candidateHostsList);
-
- // Get the intersection.
- candidateHosts.retainAll(serviceHostComponents.keySet());
-
- if (candidateHosts.isEmpty()) {
- throw new AmbariException(MessageFormat.format("The resource filter
for hosts does not contain components for " +
- "service: {0}, component: {1} in cluster: {2}", serviceName,
componentName, clusterName));
- }
- } else {
- candidateHosts = serviceHostComponents.keySet();
- }
+
componentHosts.putAll(cluster.getService(serviceName).getServiceComponent(componentName)
+ .getHostsForServiceComponents());
} else {
// TODO: This code branch looks unreliable (taking random component,
should prefer the clients)
Map<String, ServiceComponent> serviceComponents =
cluster.getService(serviceName).getServiceComponents();
- // Filter components without any HOST
- Iterator<String> serviceComponentNameIterator =
serviceComponents.keySet().iterator();
- while (serviceComponentNameIterator.hasNext()){
- String componentToCheck = serviceComponentNameIterator.next();
- if
(serviceComponents.get(componentToCheck).getServiceComponentHosts().isEmpty()){
- serviceComponentNameIterator.remove();
- }
- }
-
- if (serviceComponents.isEmpty()) {
- throw new AmbariException(MessageFormat.format("Did not find any hosts
with components for service: {0} in cluster: {1}",
- serviceName, clusterName));
+ for (ServiceComponent serviceComponent : serviceComponents.values()) {
+ componentHosts.putAll(serviceComponent.getHostsForServiceComponents());
}
+ }
- // Pick a random service (should prefer clients).
- ServiceComponent serviceComponent =
serviceComponents.values().iterator().next();
- serviceHostComponents = serviceComponent.getServiceComponentHosts();
- candidateHosts = serviceHostComponents.keySet();
+ if (componentHosts.isEmpty()) {
+ throw new AmbariException(MessageFormat.format("Did not find any hosts
with components for service: {0} in cluster: {1}",
+ serviceName, clusterName));
}
+ Set<String> candidateHosts = filterProvidedCandidateHosts(resourceFilter,
componentHosts.keySet(), serviceName,
+ null, clusterName);
// check if all hostnames are valid.
for(String candidateHostName: candidateHosts) {
- ServiceComponentHost serviceComponentHost =
serviceHostComponents.get(candidateHostName);
+ Host host = componentHosts.get(candidateHostName);
- if (serviceComponentHost == null) {
+ if (host == null) {
throw new AmbariException("Provided hostname = "
+ candidateHostName + " is either not a valid cluster host or does
not satisfy the filter condition.");
}
@@ -620,8 +592,7 @@ public class AmbariCustomCommandExecutionHelper {
Iterator<String> iterator = candidateHosts.iterator();
while (iterator.hasNext()) {
String candidateHostName = iterator.next();
- ServiceComponentHost serviceComponentHost =
serviceHostComponents.get(candidateHostName);
- Host host = serviceComponentHost.getHost();
+ Host host = componentHosts.get(candidateHostName);
if (host.getMaintenanceState(cluster.getClusterId()) ==
MaintenanceState.ON) {
hostsInMaintenanceMode.add(candidateHostName);
iterator.remove();
@@ -650,6 +621,31 @@ public class AmbariCustomCommandExecutionHelper {
actionExecutionContext.isFailureAutoSkipped());
}
+ private Set<String> filterProvidedCandidateHosts(RequestResourceFilter
resourceFilter,
+ Set<String>
componentHostsNames,
+ String serviceName, String
componentName,
+ String clusterName) throws
AmbariException {
+ List<String> candidateHostsList = resourceFilter.getHostNames();
+ Set<String> candidateHosts;
+
+ // If specified a specific host, run on it as long as it contains the
component.
+ // Otherwise, use candidates that contain the component.
+ if (CollectionUtils.isNotEmpty(candidateHostsList)) {
+ candidateHosts = new HashSet<>(candidateHostsList);
+
+ // Get the intersection.
+ candidateHosts.retainAll(componentHostsNames);
+
+ if (candidateHosts.isEmpty()) {
+ throw new AmbariException(MessageFormat.format("The resource filter
for hosts does not contain components for " +
+ "service: {0}, component: {1} in cluster: {2}", serviceName,
componentName, clusterName));
+ }
+ } else {
+ candidateHosts = componentHostsNames;
+ }
+ return candidateHosts;
+ }
+
/**
* Assuming all hosts are healthy and not in maintenance mode. Rank the
hosts based on availability.
* Let S = all hosts with 0 PENDING/RUNNING/QUEUED/IN-PROGRESS tasks
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 9036ac4..4bce8a2 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -1158,7 +1158,7 @@ public class UpgradeResourceProvider extends
AbstractControllerResourceProvider
List<RequestResourceFilter> filters = new ArrayList<>();
for (TaskWrapper tw : wrapper.getTasks()) {
- filters.add(new RequestResourceFilter(tw.getService(), "",
Collections.<String> emptyList()));
+ filters.add(new RequestResourceFilter(tw.getService(), "", new
ArrayList<>(tw.getHosts())));
}
Cluster cluster = context.getCluster();
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
index 9fb2aba..b7a9eb9 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
@@ -73,6 +73,8 @@ public interface ServiceComponent {
Map<String, ServiceComponentHost> getServiceComponentHosts();
+ Map<String, Host> getHostsForServiceComponents();
+
ServiceComponentHost getServiceComponentHost(String hostname)
throws AmbariException;
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
index 5f85e38..866deb4 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
@@ -263,6 +263,15 @@ public class ServiceComponentImpl implements
ServiceComponent {
}
@Override
+ public Map<String, Host> getHostsForServiceComponents() {
+ Map<String, Host> hosts = new HashMap<>();
+ for (Map.Entry<String, ServiceComponentHost> hostComponent :
hostComponents.entrySet()) {
+ hosts.put(hostComponent.getKey(), hostComponent.getValue().getHost());
+ }
+ return hosts;
+ }
+
+ @Override
public void addServiceComponentHosts(
Map<String, ServiceComponentHost> hostComponents) throws AmbariException
{
// TODO validation
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
index 9368f80..cf93ddb 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
@@ -1278,7 +1278,7 @@ public class UpgradeContext {
List<String> hostsFromRequest = new ArrayList<>(hostOrderItems.size());
for (HostOrderItem hostOrderItem : hostOrderItems) {
if (hostOrderItem.getType() == HostOrderActionType.HOST_UPGRADE) {
- hostsFromRequest.addAll(hostOrderItem.getActionItems());
+ hostsFromRequest.addAll(hostOrderItem.getHosts());
}
}
@@ -1350,11 +1350,11 @@ public class UpgradeContext {
}
if (CollectionUtils.isNotEmpty(hosts)) {
- hostOrderItems.add(new
HostOrderItem(HostOrderActionType.HOST_UPGRADE, hosts));
+ hostOrderItems.add(new
HostOrderItem(HostOrderActionType.HOST_UPGRADE, hosts,
Collections.<String>emptyList()));
}
if (CollectionUtils.isNotEmpty(serviceChecks)) {
- hostOrderItems.add(new
HostOrderItem(HostOrderActionType.SERVICE_CHECK, serviceChecks));
+ hostOrderItems.add(new
HostOrderItem(HostOrderActionType.SERVICE_CHECK, hosts, serviceChecks));
}
}
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 4170b12..888ea57 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -139,6 +139,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Functions;
+import com.google.common.base.Objects;
import com.google.common.base.Predicate;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
@@ -2839,4 +2840,17 @@ public class ClusterImpl implements Cluster {
return componentVersionMap;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ClusterImpl cluster = (ClusterImpl) o;
+ return clusterId == cluster.clusterId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(clusterId);
+ }
}
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java
index dd2dd02..ab2d5ea 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.state.stack.upgrade;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -113,10 +114,10 @@ public class HostOrderGrouping extends Grouping {
for (HostOrderItem orderItem : hostOrderItems) {
switch (orderItem.getType()) {
case HOST_UPGRADE:
- wrappers.addAll(buildHosts(upgradeContext,
orderItem.getActionItems()));
+ wrappers.addAll(buildHosts(upgradeContext, orderItem.getHosts()));
break;
case SERVICE_CHECK:
- wrappers.addAll(buildServiceChecks(upgradeContext,
orderItem.getActionItems()));
+ wrappers.addAll(buildServiceChecks(upgradeContext,
orderItem.getHosts(), orderItem.getChecks()));
break;
}
}
@@ -295,7 +296,8 @@ public class HostOrderGrouping extends Grouping {
* @param upgradeContext the context
* @return the wrappers for a host
*/
- private List<StageWrapper> buildServiceChecks(UpgradeContext
upgradeContext, List<String> serviceChecks) {
+ private List<StageWrapper> buildServiceChecks(UpgradeContext
upgradeContext, List<String> hosts,
+ List<String> serviceChecks) {
if (CollectionUtils.isEmpty(serviceChecks)) {
return Collections.emptyList();
}
@@ -317,13 +319,18 @@ public class HostOrderGrouping extends Grouping {
continue;
}
- StageWrapper wrapper = new
StageWrapper(StageWrapper.Type.SERVICE_CHECK,
- String.format("Service Check %s",
upgradeContext.getServiceDisplay(serviceName)),
- new TaskWrapper(serviceName, "", Collections.<String>emptySet(),
new ServiceCheckTask()));
-
- wrappers.add(wrapper);
+ if (CollectionUtils.isEmpty(hosts)) {
+ wrappers.add(new StageWrapper(StageWrapper.Type.SERVICE_CHECK,
+ String.format("Service Check %s",
upgradeContext.getServiceDisplay(serviceName)),
+ new TaskWrapper(serviceName, "", Collections.<String>emptySet(),
new ServiceCheckTask())));
+ } else {
+ for (String host : hosts) {
+ wrappers.add(new StageWrapper(StageWrapper.Type.SERVICE_CHECK,
+ String.format("Service Check %s",
upgradeContext.getServiceDisplay(serviceName)),
+ new TaskWrapper(serviceName, "", Collections.singleton(host),
new ServiceCheckTask())));
+ }
+ }
}
-
return wrappers;
}
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderItem.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderItem.java
index bc46786..b10f5a5 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderItem.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderItem.java
@@ -58,7 +58,15 @@ public class HostOrderItem {
* {@link HostOrderActionType#SERVICE_CHECK}, then this should be a list of
* services.
*/
- private final List<String> m_actionItems;
+ private final List<String> m_hosts;
+
+ /**
+ * The items to take action on. If {@link HostOrderActionType#HOST_UPGRADE},
+ * then this should be a list of hosts. If
+ * {@link HostOrderActionType#SERVICE_CHECK}, then this should be a list of
+ * services.
+ */
+ private final List<String> m_checks;
/**
* Constructor.
@@ -66,9 +74,10 @@ public class HostOrderItem {
* @param type
* @param actionItems
*/
- public HostOrderItem(HostOrderActionType type, List<String> actionItems) {
+ public HostOrderItem(HostOrderActionType type, List<String> hosts,
List<String> checks) {
m_type = type;
- m_actionItems = actionItems;
+ m_hosts = hosts;
+ m_checks = checks;
}
/**
@@ -86,8 +95,12 @@ public class HostOrderItem {
*
* @return the list of action items.
*/
- public List<String> getActionItems() {
- return m_actionItems;
+ public List<String> getHosts() {
+ return m_hosts;
+ }
+
+ public List<String> getChecks() {
+ return m_checks;
}
/**
@@ -95,7 +108,10 @@ public class HostOrderItem {
*/
@Override
public String toString() {
- return Objects.toStringHelper(this).add("type", m_type).add("items",
- StringUtils.join(m_actionItems, ", ")).omitNullValues().toString();
+ return Objects.toStringHelper(this)
+ .add("m_type", m_type)
+ .add("m_hosts", m_hosts)
+ .add("m_checks", m_checks)
+ .toString();
}
}
\ No newline at end of file
diff --git
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
index 88ed946..ab8164e 100644
---
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
+++
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
@@ -1464,6 +1464,69 @@ public class UpgradeResourceProviderTest extends
EasyMockSupport {
assertEquals(repoVersionEntity2200, service.getDesiredRepositoryVersion());
}
+ @Test()
+ public void testCreateHostOrderedUpgrade() throws Exception {
+ Cluster cluster = clusters.getCluster("c1");
+ assertNotNull(cluster);
+ String hostName1 = "h1";
+
+ // add second host with another zookeeper client
+ String hostName2 = "h2";
+ clusters.addHost(hostName2);
+ Host host = clusters.getHost(hostName2);
+ Map<String, String> hostAttributes = new HashMap<>();
+ hostAttributes.put("os_family", "redhat");
+ hostAttributes.put("os_release_version", "6.3");
+ host.setHostAttributes(hostAttributes);
+ host.setState(HostState.HEALTHY);
+
+ clusters.mapHostToCluster(hostName2, "c1");
+
+ Service service = cluster.getService("ZOOKEEPER");
+ ServiceComponent component =
service.getServiceComponent("ZOOKEEPER_CLIENT");
+ ServiceComponentHost sch = component.addServiceComponentHost(hostName2);
+ sch.setVersion("2.1.1.0");
+
+ // prepare upgrade request
+ Map<String, Object> requestProps = new HashMap<>();
+ requestProps.put(UpgradeResourceProvider.UPGRADE_CLUSTER_NAME, "c1");
+ requestProps.put(UpgradeResourceProvider.UPGRADE_REPO_VERSION_ID,
String.valueOf(repoVersionEntity2200.getId()));
+ requestProps.put(UpgradeResourceProvider.UPGRADE_PACK,
"upgrade_test_host_ordered");
+ requestProps.put(UpgradeResourceProvider.UPGRADE_TYPE,
UpgradeType.HOST_ORDERED.toString());
+ requestProps.put(UpgradeResourceProvider.UPGRADE_SKIP_PREREQUISITE_CHECKS,
Boolean.TRUE.toString());
+ requestProps.put(UpgradeResourceProvider.UPGRADE_DIRECTION,
Direction.UPGRADE.name());
+
+ ResourceProvider upgradeResourceProvider = createProvider(amc);
+ Request request =
PropertyHelper.getCreateRequest(Collections.singleton(requestProps), null);
+
+ Set<Map<String, List<String>>> hostsOrder = new LinkedHashSet<>();
+ Map<String, List<String>> hostGrouping = new HashMap<>();
+ hostGrouping.put("hosts", Lists.newArrayList(hostName1, hostName2));
+ hostGrouping.put("service_checks", Lists.newArrayList("ZOOKEEPER"));
+ hostsOrder.add(hostGrouping);
+
+ requestProps.put(UpgradeResourceProvider.UPGRADE_HOST_ORDERED_HOSTS,
hostsOrder);
+ upgradeResourceProvider.createResources(request);
+
+ // find created service check tasks and check their hosts
+ List<RequestEntity> requestEntities = requestDao.findAll();
+ assertEquals(1, requestEntities.size());
+
+ RequestEntity requestEntity = requestEntities.get(0);
+
+ List<StageEntity> checkStages = new ArrayList<>();
+ for (StageEntity stageEntity : requestEntity.getStages()) {
+ if ("Service Check ZOOKEEPER".equals(stageEntity.getRequestContext())) {
+ checkStages.add(stageEntity);
+ }
+ }
+ assertEquals(2, checkStages.size());
+ assertEquals(1, checkStages.get(0).getHostRoleCommands().size());
+ assertEquals(1, checkStages.get(1).getHostRoleCommands().size());
+ assertEquals(hostName1,
checkStages.get(0).getHostRoleCommands().iterator().next().getHostName());
+ assertEquals(hostName2,
checkStages.get(1).getHostRoleCommands().iterator().next().getHostName());
+ }
+
/**
* Exercises that a component that goes from upgrade->downgrade that switches
* {@code versionAdvertised} between will go to UKNOWN. This exercises
diff --git
a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
index c40c5e3..8cde61e 100644
---
a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
+++
b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
@@ -2107,10 +2107,10 @@ public class UpgradeHelperTest extends EasyMockSupport {
// !!! make a custom grouping
HostOrderItem hostItem = new
HostOrderItem(HostOrderActionType.HOST_UPGRADE,
- Lists.newArrayList("h1", "h2"));
+ Lists.newArrayList("h1", "h2"), Collections.<String>emptyList());
HostOrderItem checkItem = new
HostOrderItem(HostOrderActionType.SERVICE_CHECK,
- Lists.newArrayList("ZOOKEEPER", "HBASE"));
+ Lists.newArrayList("h1", "h2"), Lists.newArrayList("ZOOKEEPER",
"HBASE"));
Grouping g = new HostOrderGrouping();
((HostOrderGrouping) g).setHostOrderItems(Lists.newArrayList(hostItem,
checkItem));
@@ -2140,7 +2140,7 @@ public class UpgradeHelperTest extends EasyMockSupport {
assertEquals(1, groups.size());
UpgradeGroupHolder holder = groups.get(0);
- assertEquals(9, holder.items.size());
+ assertEquals(11, holder.items.size());
for (int i = 0; i < 7; i++) {
StageWrapper w = holder.items.get(i);
@@ -2163,8 +2163,11 @@ public class UpgradeHelperTest extends EasyMockSupport {
}
}
+ // two hosts with two checks for each
assertEquals(StageWrapper.Type.SERVICE_CHECK,
holder.items.get(7).getType());
assertEquals(StageWrapper.Type.SERVICE_CHECK,
holder.items.get(8).getType());
+ assertEquals(StageWrapper.Type.SERVICE_CHECK,
holder.items.get(9).getType());
+ assertEquals(StageWrapper.Type.SERVICE_CHECK,
holder.items.get(10).getType());
// !!! test downgrade when all host components have failed
zookeeperServer1.setVersion(repoVersion211.getVersion());
@@ -2181,7 +2184,7 @@ public class UpgradeHelperTest extends EasyMockSupport {
groups = m_upgradeHelper.createSequence(upgradePack, context);
assertEquals(1, groups.size());
- assertEquals(2, groups.get(0).items.size());
+ assertEquals(4, groups.get(0).items.size());
// !!! test downgrade when one of the hosts had failed
zookeeperServer1.setVersion(repoVersion211.getVersion());
@@ -2198,7 +2201,7 @@ public class UpgradeHelperTest extends EasyMockSupport {
groups = m_upgradeHelper.createSequence(upgradePack, context);
assertEquals(1, groups.size());
- assertEquals(5, groups.get(0).items.size());
+ assertEquals(7, groups.get(0).items.size());
}
/**