use of io.fabric8.maven.core.config.ResourceConfig in project fabric8-maven-plugin by fabric8io.
the class DaemonSetHandlerTest method daemonTemplateHandlerTest.
@Test
public void daemonTemplateHandlerTest() {
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
DaemonSetHandler daemonSetHandler = new DaemonSetHandler(podTemplateHandler);
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("testing").withServiceAccount("test-account").volumes(volumes1).build();
DaemonSet daemonSet = daemonSetHandler.getDaemonSet(config, images);
// Assertion
assertNotNull(daemonSet.getSpec());
assertNotNull(daemonSet.getMetadata());
assertNotNull(daemonSet.getSpec().getTemplate());
assertEquals("testing", daemonSet.getMetadata().getName());
assertEquals("test-account", daemonSet.getSpec().getTemplate().getSpec().getServiceAccountName());
assertFalse(daemonSet.getSpec().getTemplate().getSpec().getVolumes().isEmpty());
assertEquals("test", daemonSet.getSpec().getTemplate().getSpec().getVolumes().get(0).getName());
assertEquals("/test/path", daemonSet.getSpec().getTemplate().getSpec().getVolumes().get(0).getHostPath().getPath());
assertNotNull(daemonSet.getSpec().getTemplate().getSpec().getContainers());
}
use of io.fabric8.maven.core.config.ResourceConfig in project fabric8-maven-plugin by fabric8io.
the class DaemonSetHandlerTest method daemonTemplateHandlerWithInvalidNameTest.
@Test(expected = IllegalArgumentException.class)
public void daemonTemplateHandlerWithInvalidNameTest() {
// invalid controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
DaemonSetHandler daemonSetHandler = new DaemonSetHandler(podTemplateHandler);
// with invalid controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("TesTing").withServiceAccount("test-account").volumes(volumes1).build();
daemonSetHandler.getDaemonSet(config, images);
}
use of io.fabric8.maven.core.config.ResourceConfig in project fabric8-maven-plugin by fabric8io.
the class DeploymentHandlerTest method deploymentTemplateHandlerWithInvalidNameTest.
@Test(expected = IllegalArgumentException.class)
public void deploymentTemplateHandlerWithInvalidNameTest() {
// invalid controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
DeploymentHandler deploymentHandler = new DeploymentHandler(podTemplateHandler);
// with invalid controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("TesTing").withServiceAccount("test-account").withReplicas(5).volumes(volumes1).build();
deploymentHandler.getDeployment(config, images);
}
use of io.fabric8.maven.core.config.ResourceConfig in project fabric8-maven-plugin by fabric8io.
the class PodTemplateHandler method getVolumes.
private List<Volume> getVolumes(ResourceConfig config) {
List<VolumeConfig> volumeConfigs = config.getVolumes();
List<Volume> ret = new ArrayList<>();
if (volumeConfigs != null) {
for (VolumeConfig volumeConfig : volumeConfigs) {
VolumeType type = VolumeType.typeFor(volumeConfig.getType());
if (type != null) {
ret.add(type.fromConfig(volumeConfig));
}
}
}
return ret;
}
Aggregations