use of org.csanchez.jenkins.plugins.kubernetes.PodTemplate in project configuration-as-code-plugin by jenkinsci.
the class KubernetesCloudTest method configure_kubernetes_cloud.
@Test
@ConfiguredWithReadme("kubernetes/README.md")
public void configure_kubernetes_cloud() {
final KubernetesCloud cloud = j.jenkins.clouds.get(KubernetesCloud.class);
assertNotNull(cloud);
assertEquals("advanced-k8s-config", cloud.name);
assertEquals("https://avanced-k8s-config:443", cloud.getServerUrl());
assertEquals("serverCertificate", cloud.getServerCertificate());
assertTrue(cloud.isSkipTlsVerify());
assertEquals("default", cloud.getNamespace());
assertEquals("http://jenkins/", cloud.getJenkinsUrl());
assertEquals("advanced-k8s-credentials", cloud.getCredentialsId());
assertEquals("jenkinsTunnel", cloud.getJenkinsTunnel());
assertEquals(42, cloud.getContainerCap());
assertEquals(5, cloud.getRetentionTimeout());
assertEquals(10, cloud.getConnectTimeout());
assertEquals(20, cloud.getReadTimeout());
assertEquals("64", cloud.getMaxRequestsPerHostStr());
final List<PodTemplate> templates = cloud.getTemplates();
assertEquals(2, templates.size());
final PodTemplate template = templates.get(0);
assertEquals("test", template.getName());
assertEquals("serviceAccount", template.getServiceAccount());
assertEquals(1234, template.getInstanceCap());
assertEquals("label", template.getLabel());
final List<PodVolume> volumes = template.getVolumes();
assertEquals(1, volumes.size());
final PodVolume volume = volumes.get(0);
assertTrue(volume instanceof HostPathVolume);
assertEquals("mountPath", volume.getMountPath());
assertEquals("hostPath", ((HostPathVolume) volume).getHostPath());
final List<TemplateEnvVar> envVars = template.getEnvVars();
assertEquals(1, envVars.size());
final KeyValueEnvVar envVar = (KeyValueEnvVar) envVars.get(0);
assertEquals("FOO", envVar.getKey());
assertEquals("BAR", envVar.getValue());
final PodTemplate template1 = templates.get(1);
assertEquals("k8s-agent", template1.getName());
assertEquals("default", template1.getNamespace());
assertEquals(Mode.EXCLUSIVE, template1.getNodeUsageMode());
}
Aggregations