Search in sources :

Example 21 with PodTemplateBuilder

use of org.csanchez.jenkins.plugins.kubernetes.PodTemplateBuilder in project kubernetes-plugin by jenkinsci.

the class PodTemplateBuilderTest method defaultRequests.

@Test
public void defaultRequests() throws Exception {
    PodTemplate template = new PodTemplate();
    Pod pod = new PodTemplateBuilder(template, slave).build();
    ResourceRequirements resources = pod.getSpec().getContainers().get(0).getResources();
    assertNotNull(resources);
    Map<String, Quantity> requests = resources.getRequests();
    assertNotNull(requests);
    PodTemplateUtilsTest.assertQuantity(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_CPU_REQUEST, requests.get("cpu"));
    PodTemplateUtilsTest.assertQuantity(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_MEMORY_REQUEST, requests.get("memory"));
}
Also used : PodTemplateBuilder(org.csanchez.jenkins.plugins.kubernetes.PodTemplateBuilder) Pod(io.fabric8.kubernetes.api.model.Pod) Quantity(io.fabric8.kubernetes.api.model.Quantity) ResourceRequirements(io.fabric8.kubernetes.api.model.ResourceRequirements) Test(org.junit.Test)

Aggregations

Pod (io.fabric8.kubernetes.api.model.Pod)21 PodTemplateBuilder (org.csanchez.jenkins.plugins.kubernetes.PodTemplateBuilder)21 Test (org.junit.Test)21 Container (io.fabric8.kubernetes.api.model.Container)16 Parameters (junitparams.Parameters)13 TestCaseName (junitparams.naming.TestCaseName)13 Quantity (io.fabric8.kubernetes.api.model.Quantity)8 VolumeMount (io.fabric8.kubernetes.api.model.VolumeMount)8 VolumeMountBuilder (io.fabric8.kubernetes.api.model.VolumeMountBuilder)8 KeyValueEnvVar (org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar)8 TemplateEnvVar (org.csanchez.jenkins.plugins.kubernetes.model.TemplateEnvVar)8 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)7 PodSecurityContext (io.fabric8.kubernetes.api.model.PodSecurityContext)7 ResourceRequirements (io.fabric8.kubernetes.api.model.ResourceRequirements)7 ArrayList (java.util.ArrayList)7 EmptyDirVolume (org.csanchez.jenkins.plugins.kubernetes.volumes.EmptyDirVolume)7 HostPathVolume (org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume)7 PodVolume (org.csanchez.jenkins.plugins.kubernetes.volumes.PodVolume)7 DynamicPVCWorkspaceVolume (org.csanchez.jenkins.plugins.kubernetes.volumes.workspace.DynamicPVCWorkspaceVolume)7 EmptyDirWorkspaceVolume (org.csanchez.jenkins.plugins.kubernetes.volumes.workspace.EmptyDirWorkspaceVolume)7