Search in sources :

Example 26 with DeploymentGroup

use of com.spotify.helios.common.descriptors.DeploymentGroup in project helios by spotify.

the class RollingUndeployPlannerTest method testParallelRolloutWithRemainder.

@Test
public void testParallelRolloutWithRemainder() {
    final DeploymentGroup deploymentGroup = DeploymentGroup.newBuilder().setRolloutOptions(RolloutOptions.newBuilder().setParallelism(3).build()).build();
    final RolloutPlanner rolloutPlanner = RollingUndeployPlanner.of(deploymentGroup);
    final List<RolloutTask> tasks = rolloutPlanner.plan(HOSTS);
    final List<RolloutTask> expected = Lists.newArrayList(RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent1"), RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent2"), RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent3"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent1"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent1"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent2"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent2"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent3"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent3"), RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent4"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent4"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent4"));
    assertEquals(expected, tasks);
}
Also used : RolloutTask(com.spotify.helios.common.descriptors.RolloutTask) DeploymentGroup(com.spotify.helios.common.descriptors.DeploymentGroup) Test(org.junit.Test)

Example 27 with DeploymentGroup

use of com.spotify.helios.common.descriptors.DeploymentGroup in project helios by spotify.

the class RollingUndeployPlannerTest method testParallelRollout.

@Test
public void testParallelRollout() {
    final DeploymentGroup deploymentGroup = DeploymentGroup.newBuilder().setRolloutOptions(RolloutOptions.newBuilder().setParallelism(2).build()).build();
    final RolloutPlanner rolloutPlanner = RollingUndeployPlanner.of(deploymentGroup);
    final List<RolloutTask> tasks = rolloutPlanner.plan(HOSTS);
    final List<RolloutTask> expected = Lists.newArrayList(RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent1"), RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent2"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent1"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent1"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent2"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent2"), RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent3"), RolloutTask.of(RolloutTask.Action.FORCE_UNDEPLOY_JOBS, "agent4"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent3"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent3"), RolloutTask.of(RolloutTask.Action.AWAIT_UNDEPLOYED, "agent4"), RolloutTask.of(RolloutTask.Action.MARK_UNDEPLOYED, "agent4"));
    assertEquals(expected, tasks);
}
Also used : RolloutTask(com.spotify.helios.common.descriptors.RolloutTask) DeploymentGroup(com.spotify.helios.common.descriptors.DeploymentGroup) Test(org.junit.Test)

Example 28 with DeploymentGroup

use of com.spotify.helios.common.descriptors.DeploymentGroup in project helios by spotify.

the class RollingUpdatePlannerTest method testParallelRolloutWithRemainder.

@Test
public void testParallelRolloutWithRemainder() {
    final DeploymentGroup deploymentGroup = DeploymentGroup.newBuilder().setRolloutOptions(RolloutOptions.newBuilder().setParallelism(3).build()).build();
    final RolloutPlanner rolloutPlanner = RollingUpdatePlanner.of(deploymentGroup);
    final List<RolloutTask> tasks = rolloutPlanner.plan(HOSTS);
    final List<RolloutTask> expected = Lists.newArrayList(RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent1"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent1"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent2"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent2"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent3"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent3"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent1"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent2"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent3"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent4"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent4"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent4"));
    assertEquals(expected, tasks);
}
Also used : RolloutTask(com.spotify.helios.common.descriptors.RolloutTask) DeploymentGroup(com.spotify.helios.common.descriptors.DeploymentGroup) Test(org.junit.Test)

Example 29 with DeploymentGroup

use of com.spotify.helios.common.descriptors.DeploymentGroup in project helios by spotify.

the class RollingUpdatePlannerTest method testSerialRollout.

@Test
public void testSerialRollout() {
    final DeploymentGroup deploymentGroup = DeploymentGroup.newBuilder().setRolloutOptions(RolloutOptions.newBuilder().setParallelism(1).build()).build();
    final RolloutPlanner rolloutPlanner = RollingUpdatePlanner.of(deploymentGroup);
    final List<RolloutTask> tasks = rolloutPlanner.plan(HOSTS);
    final List<RolloutTask> expected = Lists.newArrayList(RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent1"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent1"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent1"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent2"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent2"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent2"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent3"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent3"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent3"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent4"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent4"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent4"));
    assertEquals(expected, tasks);
}
Also used : RolloutTask(com.spotify.helios.common.descriptors.RolloutTask) DeploymentGroup(com.spotify.helios.common.descriptors.DeploymentGroup) Test(org.junit.Test)

Example 30 with DeploymentGroup

use of com.spotify.helios.common.descriptors.DeploymentGroup in project helios by spotify.

the class RollingUpdatePlannerTest method testOverlapRollout.

@Test
public void testOverlapRollout() {
    final DeploymentGroup deploymentGroup = DeploymentGroup.newBuilder().setRolloutOptions(RolloutOptions.newBuilder().setOverlap(true).build()).build();
    final RolloutPlanner rolloutPlanner = RollingUpdatePlanner.of(deploymentGroup);
    final List<RolloutTask> tasks = rolloutPlanner.plan(HOSTS);
    final List<RolloutTask> expected = Lists.newArrayList(RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent1"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent1"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent1"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent2"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent2"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent2"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent3"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent3"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent3"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "agent4"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "agent4"), RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "agent4"));
    assertEquals(expected, tasks);
}
Also used : RolloutTask(com.spotify.helios.common.descriptors.RolloutTask) DeploymentGroup(com.spotify.helios.common.descriptors.DeploymentGroup) Test(org.junit.Test)

Aggregations

DeploymentGroup (com.spotify.helios.common.descriptors.DeploymentGroup)30 Test (org.junit.Test)18 RolloutTask (com.spotify.helios.common.descriptors.RolloutTask)10 ZooKeeperClient (com.spotify.helios.servicescommon.coordination.ZooKeeperClient)10 HeliosRuntimeException (com.spotify.helios.common.HeliosRuntimeException)6 ZooKeeperOperation (com.spotify.helios.servicescommon.coordination.ZooKeeperOperation)6 Job (com.spotify.helios.common.descriptors.Job)4 CreateDeploymentGroupResponse (com.spotify.helios.common.protocol.CreateDeploymentGroupResponse)4 RollingUpdateResponse (com.spotify.helios.common.protocol.RollingUpdateResponse)4 KeeperException (org.apache.zookeeper.KeeperException)4 NoNodeException (org.apache.zookeeper.KeeperException.NoNodeException)4 DeploymentGroupStatus (com.spotify.helios.common.descriptors.DeploymentGroupStatus)3 HostStatus (com.spotify.helios.common.descriptors.HostStatus)3 JobId (com.spotify.helios.common.descriptors.JobId)3 RemoveDeploymentGroupResponse (com.spotify.helios.common.protocol.RemoveDeploymentGroupResponse)3 DefaultZooKeeperClient (com.spotify.helios.servicescommon.coordination.DefaultZooKeeperClient)3 IOException (java.io.IOException)3 Response (javax.ws.rs.core.Response)3 ExceptionMetered (com.codahale.metrics.annotation.ExceptionMetered)2 Timed (com.codahale.metrics.annotation.Timed)2