Search in sources :

Example 1 with TestStep

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

the class ParallelStrategyTest method testProceedInterrupt.

@Test
public void testProceedInterrupt() {
    TestStep step0 = new TestStep();
    TestStep step1 = new TestStep();
    List<Step> steps = Arrays.asList(step0, step1);
    Collection<Step> candidates = getCandidates(strategy, steps);
    Assert.assertEquals(2, candidates.size());
    Assert.assertEquals(new HashSet<>(steps), new HashSet<>(candidates));
    strategy.interrupt();
    Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
    strategy.proceed();
    candidates = getCandidates(strategy, steps);
    Assert.assertEquals(2, candidates.size());
    Assert.assertEquals(new HashSet<>(steps), new HashSet<>(candidates));
    step0.setStatus(Status.COMPLETE);
    Assert.assertEquals(step1, getCandidates(strategy, steps).iterator().next());
    strategy.interrupt();
    Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
    strategy.proceed();
    Assert.assertEquals(step1, getCandidates(strategy, steps).iterator().next());
    step1.setStatus(Status.COMPLETE);
    Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
    strategy.interrupt();
    Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
}
Also used : TestStep(com.mesosphere.sdk.scheduler.plan.TestStep) Step(com.mesosphere.sdk.scheduler.plan.Step) TestStep(com.mesosphere.sdk.scheduler.plan.TestStep) Test(org.junit.Test)

Aggregations

Step (com.mesosphere.sdk.scheduler.plan.Step)1 TestStep (com.mesosphere.sdk.scheduler.plan.TestStep)1 Test (org.junit.Test)1