Search in sources :

Example 41 with OfferRecommendation

use of com.mesosphere.sdk.offer.OfferRecommendation in project dcos-commons by mesosphere.

the class ResourceCleanupStepTest method testNonMatchingUpdateOfferStatus.

@Test
public void testNonMatchingUpdateOfferStatus() throws Exception {
    OfferRecommendation offerRecommendation = new UnreserveOfferRecommendation(null, ResourceTestUtils.getReservedCpus(1.0, DIFFERENT_RESOURCE_ID));
    resourceCleanupStep.start();
    resourceCleanupStep.updateOfferStatus(Collections.singletonList(offerRecommendation));
    assert resourceCleanupStep.getStatus().equals(Status.PREPARED);
}
Also used : UnreserveOfferRecommendation(com.mesosphere.sdk.offer.UnreserveOfferRecommendation) UnreserveOfferRecommendation(com.mesosphere.sdk.offer.UnreserveOfferRecommendation) CreateOfferRecommendation(com.mesosphere.sdk.offer.CreateOfferRecommendation) OfferRecommendation(com.mesosphere.sdk.offer.OfferRecommendation) Test(org.junit.Test)

Example 42 with OfferRecommendation

use of com.mesosphere.sdk.offer.OfferRecommendation in project dcos-commons by mesosphere.

the class ResourceCleanupStepTest method testMixedUpdateOfferStatus.

@Test
public void testMixedUpdateOfferStatus() throws Exception {
    OfferRecommendation rec1 = new CreateOfferRecommendation(null, ResourceTestUtils.getReservedRootVolume(999.0));
    OfferRecommendation rec2 = new UnreserveOfferRecommendation(null, ResourceTestUtils.getReservedCpus(1.0, TestConstants.RESOURCE_ID));
    resourceCleanupStep.start();
    resourceCleanupStep.updateOfferStatus(Arrays.asList(rec1, rec2));
    assert resourceCleanupStep.getStatus().equals(Status.COMPLETE);
}
Also used : UnreserveOfferRecommendation(com.mesosphere.sdk.offer.UnreserveOfferRecommendation) UnreserveOfferRecommendation(com.mesosphere.sdk.offer.UnreserveOfferRecommendation) CreateOfferRecommendation(com.mesosphere.sdk.offer.CreateOfferRecommendation) OfferRecommendation(com.mesosphere.sdk.offer.OfferRecommendation) CreateOfferRecommendation(com.mesosphere.sdk.offer.CreateOfferRecommendation) Test(org.junit.Test)

Aggregations

OfferRecommendation (com.mesosphere.sdk.offer.OfferRecommendation)42 Test (org.junit.Test)39 Resource (org.apache.mesos.Protos.Resource)30 Operation (org.apache.mesos.Protos.Offer.Operation)26 PodInstanceRequirement (com.mesosphere.sdk.scheduler.plan.PodInstanceRequirement)21 Protos (org.apache.mesos.Protos)21 TaskInfo (org.apache.mesos.Protos.TaskInfo)13 UnreserveOfferRecommendation (com.mesosphere.sdk.offer.UnreserveOfferRecommendation)6 CreateOfferRecommendation (com.mesosphere.sdk.offer.CreateOfferRecommendation)4 PlacementRule (com.mesosphere.sdk.offer.evaluate.placement.PlacementRule)4 DefaultPodInstance (com.mesosphere.sdk.scheduler.plan.DefaultPodInstance)4 DefaultPodSpec (com.mesosphere.sdk.specification.DefaultPodSpec)4 DefaultResourceSet (com.mesosphere.sdk.specification.DefaultResourceSet)4 DefaultVolumeSpec (com.mesosphere.sdk.specification.DefaultVolumeSpec)4 PodInstance (com.mesosphere.sdk.specification.PodInstance)4 PodSpec (com.mesosphere.sdk.specification.PodSpec)4 ResourceSet (com.mesosphere.sdk.specification.ResourceSet)4 ReserveOfferRecommendation (com.mesosphere.sdk.offer.ReserveOfferRecommendation)3 ReserveEvaluationOutcome (com.mesosphere.sdk.offer.evaluate.OfferEvaluationUtils.ReserveEvaluationOutcome)3 DefaultResourceSpec (com.mesosphere.sdk.specification.DefaultResourceSpec)3