Search in sources :

Example 21 with Persister

use of com.mesosphere.sdk.storage.Persister in project dcos-commons by mesosphere.

the class SchedulerRunnerTest method checkSchemaVersion.

@Test
public void checkSchemaVersion() throws Exception {
    // Set up a schema version which shouldn't work, to verify that the schema version is being checked:
    Persister persister = new MemPersister();
    persister.set("SchemaVersion", "123".getBytes(StandardCharsets.UTF_8));
    when(mockSchedulerBuilder.getPersister()).thenReturn(persister);
    when(mockSchedulerBuilder.getSchedulerConfig()).thenReturn(mockSchedulerConfig);
    when(mockSchedulerBuilder.getServiceSpec()).thenReturn(mockServiceSpec);
    SchedulerRunner runner = SchedulerRunner.fromSchedulerBuilder(mockSchedulerBuilder);
    try {
        runner.run();
        Assert.fail("Expected exception due to bad schema version");
    } catch (IllegalStateException e) {
        Assert.assertEquals("Storage schema version 123 is not supported by this software (expected: 1)", e.getMessage());
    }
}
Also used : MemPersister(com.mesosphere.sdk.storage.MemPersister) MemPersister(com.mesosphere.sdk.storage.MemPersister) Persister(com.mesosphere.sdk.storage.Persister) Test(org.junit.Test)

Aggregations

Persister (com.mesosphere.sdk.storage.Persister)21 MemPersister (com.mesosphere.sdk.storage.MemPersister)17 StateStore (com.mesosphere.sdk.state.StateStore)10 Test (org.junit.Test)8 FrameworkStore (com.mesosphere.sdk.state.FrameworkStore)6 Plan (com.mesosphere.sdk.scheduler.plan.Plan)4 UUID (java.util.UUID)4 Before (org.junit.Before)4 OfferOutcomeTracker (com.mesosphere.sdk.offer.history.OfferOutcomeTracker)3 OfferAccepter (com.mesosphere.sdk.offer.OfferAccepter)2 OfferEvaluator (com.mesosphere.sdk.offer.evaluate.OfferEvaluator)2 DefaultPlan (com.mesosphere.sdk.scheduler.plan.DefaultPlan)2 Phase (com.mesosphere.sdk.scheduler.plan.Phase)2 RawServiceSpec (com.mesosphere.sdk.specification.yaml.RawServiceSpec)2 PersisterException (com.mesosphere.sdk.storage.PersisterException)2 File (java.io.File)2 ApiServer (com.mesosphere.sdk.framework.ApiServer)1 FrameworkRunner (com.mesosphere.sdk.framework.FrameworkRunner)1 HealthResource (com.mesosphere.sdk.http.endpoints.HealthResource)1 PlansResource (com.mesosphere.sdk.http.endpoints.PlansResource)1