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());
}
}
Aggregations