use of com.mesosphere.sdk.specification.PodSpec in project dcos-commons by mesosphere.
the class PlacementUtilsTest method simpleNotRegionRuleFails.
@Test
public void simpleNotRegionRuleFails() {
PlacementRule rule = new ZoneRule(ExactMatcher.create("zone"));
PodSpec podSpec = getPodSpec(rule);
assertFalse(PlacementUtils.placementRuleReferencesRegion(podSpec));
}
use of com.mesosphere.sdk.specification.PodSpec in project dcos-commons by mesosphere.
the class PlacementUtilsTest method nestedOrRegionRuleSucceeds.
@Test
public void nestedOrRegionRuleSucceeds() {
PlacementRule regionRule = new RegionRule(ExactMatcher.create("region"));
PlacementRule zoneRule = new ZoneRule(ExactMatcher.create("zone"));
PlacementRule orRule = new OrRule(regionRule, zoneRule);
PlacementRule attributeRule = new AttributeRule(ExactMatcher.create("attribute"));
PlacementRule andRule = new AndRule(attributeRule, orRule);
PodSpec podSpec = getPodSpec(andRule);
assertTrue(PlacementUtils.placementRuleReferencesRegion(podSpec));
}
use of com.mesosphere.sdk.specification.PodSpec in project dcos-commons by mesosphere.
the class PlacementUtilsTest method passThroughRuleNotRegion.
@Test
public void passThroughRuleNotRegion() {
PlacementRule rule = new PassthroughRule();
PodSpec podSpec = getPodSpec(rule);
assertFalse(PlacementUtils.placementRuleReferencesRegion(podSpec));
}
use of com.mesosphere.sdk.specification.PodSpec in project dcos-commons by mesosphere.
the class DefaultPlanSchedulerTest method beforeEach.
@Before
public void beforeEach() throws Exception {
MockitoAnnotations.initMocks(this);
Driver.setDriver(mockSchedulerDriver);
mockRecommendations = Arrays.asList(mockRecommendation);
scheduler = new DefaultPlanScheduler(mockOfferAccepter, mockOfferEvaluator, mockStateStore);
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("valid-minimal.yml").getFile());
DefaultServiceSpec serviceSpec = DefaultServiceSpec.newGenerator(file, SCHEDULER_CONFIG).build();
PodSpec podSpec = serviceSpec.getPods().get(0);
PodInstance podInstance = new DefaultPodInstance(podSpec, 0);
podInstanceRequirement = PodInstanceRequirement.newBuilder(podInstance, TaskUtils.getTaskNames(podInstance)).build();
}
use of com.mesosphere.sdk.specification.PodSpec in project dcos-commons by mesosphere.
the class CanaryStrategyTest method beforeAll.
@BeforeClass
public static void beforeAll() {
for (int i = 0; i < 5; i++) {
PodSpec podSpec = DefaultPodSpec.newBuilder("executor-uri").type("type" + i).count(1).tasks(Arrays.asList(TestPodFactory.getTaskSpec())).build();
PodInstance podInstance = new DefaultPodInstance(podSpec, 0);
PodInstanceRequirement podInstanceRequirement = PodInstanceRequirement.newBuilder(podInstance, Arrays.asList("task0")).build();
podInstanceRequirements.add(podInstanceRequirement);
}
}
Aggregations