use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class ContainerHandlerTest method getVolumeMountWithoutMountTest.
@Test
public void getVolumeMountWithoutMountTest() {
ContainerHandler handler = createContainerHandler(project);
images.clear();
images.add(imageConfiguration1);
// volume config without mount
VolumeConfig volumeConfig1 = VolumeConfig.builder().name("first").build();
volumes1.add(volumeConfig1);
ResourceConfig config1 = ResourceConfig.builder().volumes(volumes1).build();
containers = handler.getContainers(config1, images);
assertTrue(containers.get(0).getVolumeMounts().isEmpty());
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DaemonSetHandlerTest method daemonTemplateHandlerWithoutControllerTest.
@Test(expected = IllegalArgumentException.class)
public void daemonTemplateHandlerWithoutControllerTest() {
// without controller name
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").serviceAccount("test-account").volumes(volumes1).build();
daemonSetHandler.get(config, images);
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DeploymentConfigHandlerTest method get_withNoImages_shouldReturnConfigWithNoContainers.
@Test
public void get_withNoImages_shouldReturnConfigWithNoContainers() {
// Given
final ResourceConfig resourceConfig = resourceConfigBuilder.controllerName("controller").build();
final List<ImageConfiguration> images = Collections.emptyList();
// When
final DeploymentConfig result = deploymentConfigHandler.get(resourceConfig, images);
// Then
assertThat(result).hasFieldOrPropertyWithValue("metadata.name", "controller").extracting("spec.template.spec.containers").asList().isEmpty();
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class JobHandlerTest method daemonTemplateHandlerWithoutControllerTest.
@Test
public void daemonTemplateHandlerWithoutControllerTest() {
// without controller name
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").serviceAccount("test-account").volumes(volumes1).build();
assertThrows(IllegalArgumentException.class, () -> jobHandler.get(config, images));
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class JobHandlerTest method jobHandlerTest.
@Test
public void jobHandlerTest() {
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").controllerName("testing").serviceAccount("test-account").restartPolicy("OnFailure").volumes(volumes1).build();
Job job = jobHandler.get(config, images);
// Assertion
assertNotNull(job.getSpec());
assertNotNull(job.getMetadata());
assertNotNull(job.getSpec().getTemplate());
assertEquals("testing", job.getMetadata().getName());
assertEquals("test-account", job.getSpec().getTemplate().getSpec().getServiceAccountName());
assertFalse(job.getSpec().getTemplate().getSpec().getVolumes().isEmpty());
assertEquals("OnFailure", job.getSpec().getTemplate().getSpec().getRestartPolicy());
assertEquals("test", job.getSpec().getTemplate().getSpec().getVolumes().get(0).getName());
assertEquals("/test/path", job.getSpec().getTemplate().getSpec().getVolumes().get(0).getHostPath().getPath());
assertNotNull(job.getSpec().getTemplate().getSpec().getContainers());
}
Aggregations