use of com.mesosphere.sdk.specification.DefaultServiceSpec in project dcos-commons by mesosphere.
the class PodSpecsCannotUseUnsupportedFeaturesTest method testSpecSucceedsWhenSecretIsSupported.
@Test
public void testSpecSucceedsWhenSecretIsSupported() throws Exception {
when(mockCapabilities.supportsFileBasedSecrets()).thenReturn(true);
when(mockCapabilities.supportsEnvBasedSecretsProtobuf()).thenReturn(true);
Capabilities.overrideCapabilities(mockCapabilities);
File file = new File(getClass().getClassLoader().getResource("valid-secrets.yml").getFile());
DefaultServiceSpec serviceSpec = DefaultServiceSpec.newGenerator(file, SCHEDULER_CONFIG).setConfigTemplateReader(mockConfigTemplateReader).build();
checkValidationPasses(serviceSpec);
}
use of com.mesosphere.sdk.specification.DefaultServiceSpec in project dcos-commons by mesosphere.
the class YAMLServiceSpecFactoryTest method testGenerateSpecFromYAML.
@Test
public void testGenerateSpecFromYAML() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("valid-exhaustive.yml").getFile());
when(mockConfigTemplateReader.read("config-one.conf.mustache")).thenReturn("hello");
when(mockConfigTemplateReader.read("config-two.xml.mustache")).thenReturn("hey");
when(mockConfigTemplateReader.read("config-three.conf.mustache")).thenReturn("hi");
when(mockSchedulerConfig.getApiServerPort()).thenReturn(123);
when(mockSchedulerConfig.getExecutorURI()).thenReturn("test-executor-uri");
DefaultServiceSpec serviceSpec = DefaultServiceSpec.newGenerator(file, mockSchedulerConfig).setConfigTemplateReader(mockConfigTemplateReader).build();
Assert.assertNotNull(serviceSpec);
}
use of com.mesosphere.sdk.specification.DefaultServiceSpec in project dcos-commons by mesosphere.
the class PodSpecsCannotUseUnsupportedFeaturesTest method testSpecFailsWithRLimitsButWithoutCapability.
@Test
public void testSpecFailsWithRLimitsButWithoutCapability() throws Exception {
when(mockCapabilities.supportsRLimits()).thenReturn(false);
when(mockCapabilities.supportsGpuResource()).thenReturn(true);
Capabilities.overrideCapabilities(mockCapabilities);
when(mockConfigTemplateReader.read("config-one.conf.mustache")).thenReturn("hello");
when(mockConfigTemplateReader.read("config-two.xml.mustache")).thenReturn("hey");
when(mockConfigTemplateReader.read("config-three.conf.mustache")).thenReturn("hi");
File file = new File(getClass().getClassLoader().getResource("valid-exhaustive.yml").getFile());
DefaultServiceSpec serviceSpec = DefaultServiceSpec.newGenerator(file, SCHEDULER_CONFIG).setConfigTemplateReader(mockConfigTemplateReader).build();
checkValidationErrorWithValue(serviceSpec, "rlimits");
}
use of com.mesosphere.sdk.specification.DefaultServiceSpec in project dcos-commons by mesosphere.
the class PodSpecsCannotUseUnsupportedFeaturesTest method testSpecFailsWhenFileSecretIsNotSupported.
@Test
public void testSpecFailsWhenFileSecretIsNotSupported() throws Exception {
when(mockCapabilities.supportsFileBasedSecrets()).thenReturn(false);
when(mockCapabilities.supportsEnvBasedSecretsProtobuf()).thenReturn(true);
Capabilities.overrideCapabilities(mockCapabilities);
File file = new File(getClass().getClassLoader().getResource("valid-secrets.yml").getFile());
DefaultServiceSpec serviceSpec = DefaultServiceSpec.newGenerator(file, SCHEDULER_CONFIG).setConfigTemplateReader(mockConfigTemplateReader).build();
checkValidationErrorWithValue(serviceSpec, "secrets:file");
}
use of com.mesosphere.sdk.specification.DefaultServiceSpec in project dcos-commons by mesosphere.
the class PodSpecsCannotUseUnsupportedFeaturesTest method testSpecSucceedsWithoutRLimits.
@Test
public void testSpecSucceedsWithoutRLimits() throws Exception {
when(mockCapabilities.supportsRLimits()).thenReturn(false);
when(mockCapabilities.supportsGpuResource()).thenReturn(true);
Capabilities.overrideCapabilities(mockCapabilities);
File file = new File(getClass().getClassLoader().getResource("valid-minimal.yml").getFile());
DefaultServiceSpec serviceSpec = DefaultServiceSpec.newGenerator(file, SCHEDULER_CONFIG).build();
checkValidationPasses(serviceSpec);
}
Aggregations