use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class SchedulerBuilderTest method testDeployPlanOverriddenDuringUpdate.
@Test
public void testDeployPlanOverriddenDuringUpdate() throws Exception {
Persister persister = new MemPersister();
SchedulerBuilder builder = DefaultScheduler.newBuilder(minimalServiceSpec, mockSchedulerConfig, persister);
Collection<Plan> plans = builder.selectDeployPlan(getDeployUpdatePlans(), true);
Assert.assertEquals(1, plans.size());
Plan deployPlan = plans.stream().filter(plan -> plan.isDeployPlan()).findFirst().get();
Assert.assertEquals(1, deployPlan.getChildren().size());
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class SchedulerBuilderTest method testRegionAwarenessEnabledEnvWithSchedulerRegion.
@Test
public void testRegionAwarenessEnabledEnvWithSchedulerRegion() throws PersisterException {
when(mockSchedulerConfig.getSchedulerRegion()).thenReturn(Optional.of(TestConstants.REMOTE_REGION));
when(mockSchedulerConfig.isRegionAwarenessEnabled()).thenReturn(true);
ServiceSpec updatedServiceSpec = DefaultScheduler.newBuilder(minimalServiceSpec, mockSchedulerConfig, new MemPersister()).build().getServiceSpec();
Optional<PlacementRule> rule = updatedServiceSpec.getPods().get(0).getPlacementRule();
// Pod updated with exact region rule:
Assert.assertTrue(rule.isPresent());
Assert.assertTrue(rule.get() instanceof RegionRule);
verify(mockSchedulerConfig).isRegionAwarenessEnabled();
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class SchedulerBuilderTest method testRegionAwarenessEnabledWithoutSchedulerRegion.
@Test
public void testRegionAwarenessEnabledWithoutSchedulerRegion() throws PersisterException {
ServiceSpec updatedServiceSpec = DefaultScheduler.newBuilder(minimalServiceSpec, mockSchedulerConfig, new MemPersister()).withSingleRegionConstraint().build().getServiceSpec();
Optional<PlacementRule> rule = updatedServiceSpec.getPods().get(0).getPlacementRule();
// Pod updated with local region rule:
Assert.assertTrue(rule.isPresent());
Assert.assertTrue(rule.get() instanceof IsLocalRegionRule);
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class SchedulerBuilderTest method testDeployPlanPreservedDuringInstall.
@Test
public void testDeployPlanPreservedDuringInstall() throws Exception {
Persister persister = new MemPersister();
SchedulerBuilder builder = DefaultScheduler.newBuilder(minimalServiceSpec, mockSchedulerConfig, persister);
Collection<Plan> plans = builder.selectDeployPlan(getDeployUpdatePlans(), false);
Assert.assertEquals(2, plans.size());
Plan deployPlan = plans.stream().filter(plan -> plan.isDeployPlan()).findFirst().get();
Assert.assertEquals(2, deployPlan.getChildren().size());
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class DefaultSchedulerTest method beforeEach.
@Before
public void beforeEach() throws Exception {
MockitoAnnotations.initMocks(this);
Driver.setDriver(mockSchedulerDriver);
when(mockSchedulerConfig.isStateCacheEnabled()).thenReturn(true);
ServiceSpec serviceSpec = getServiceSpec(podA, podB);
persister = new MemPersister();
stateStore = new StateStore(persister);
configStore = new ConfigStore<>(DefaultServiceSpec.getConfigurationFactory(serviceSpec), persister);
Capabilities.overrideCapabilities(getCapabilitiesWithDefaultGpuSupport());
defaultScheduler = getScheduler(serviceSpec);
}
Aggregations