Search in sources :

Example 1 with CanaryStrategy

use of com.mesosphere.sdk.scheduler.plan.strategy.CanaryStrategy in project dcos-commons by mesosphere.

the class DefaultPhaseTest method testGetStatus.

@Test
public void testGetStatus() {
    Step step1 = Mockito.mock(DeploymentStep.class);
    Step step2 = Mockito.mock(DeploymentStep.class);
    List<Step> steps = Arrays.asList(step1, step2);
    final DefaultPhase serialPhase = new DefaultPhase("serial-phase", steps, new SerialStrategy<>(), Collections.emptyList());
    when(step1.getPodInstanceRequirement()).thenReturn(Optional.empty());
    when(step2.getPodInstanceRequirement()).thenReturn(Optional.empty());
    when(step1.getStatus()).thenReturn(Status.PENDING);
    when(step2.getStatus()).thenReturn(Status.WAITING);
    Assert.assertEquals(Status.PENDING, serialPhase.getStatus());
    when(step1.getStatus()).thenReturn(Status.WAITING);
    when(step2.getStatus()).thenReturn(Status.WAITING);
    final DefaultPhase canaryPhase = new DefaultPhase("canary-phase", steps, new CanaryStrategy(new SerialStrategy<>(), steps), Collections.emptyList());
    Assert.assertEquals(Status.WAITING, canaryPhase.getStatus());
}
Also used : SerialStrategy(com.mesosphere.sdk.scheduler.plan.strategy.SerialStrategy) CanaryStrategy(com.mesosphere.sdk.scheduler.plan.strategy.CanaryStrategy) Test(org.junit.Test)

Aggregations

CanaryStrategy (com.mesosphere.sdk.scheduler.plan.strategy.CanaryStrategy)1 SerialStrategy (com.mesosphere.sdk.scheduler.plan.strategy.SerialStrategy)1 Test (org.junit.Test)1