use of com.nirima.jenkins.plugins.docker.DockerTemplate in project configuration-as-code-plugin by jenkinsci.
the class DockerCloudTest method update_docker_cloud.
@Test
@ConfiguredWithReadme("docker/README.md")
public void update_docker_cloud() throws Exception {
DockerCloud docker = DockerCloud.getCloudByName("docker");
assertNotNull(docker);
assertNotNull(docker.getDockerApi());
assertNotNull(docker.getDockerApi().getDockerHost());
assertEquals("unix:///var/run/docker.sock", docker.getDockerApi().getDockerHost().getUri());
DockerTemplate template = docker.getTemplate(Label.get("docker-agent"));
checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10", new String[] { "hello:/hello", "world:/world" }, "hello=world\nfoo=bar");
ConfigurationAsCode.get().configure(getClass().getResource("DockerCloudTest2.yml").toExternalForm());
docker = DockerCloud.getCloudByName("docker");
assertNotNull(docker);
assertNotNull(docker.getDockerApi());
assertNotNull(docker.getDockerApi().getDockerHost());
assertEquals("unix:///var/run/docker.sock", docker.getDockerApi().getDockerHost().getUri());
template = docker.getTemplate(Label.get("docker-agent"));
checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10", new String[] { "hello:/hello", "world:/world" }, "hello=world\nfoo=bar");
template = docker.getTemplate(Label.get("generic"));
checkTemplate(template, "generic", "jenkins", "/home/jenkins/agent2", "5", new String[] { "hello:/hello", "world:/world" }, "hello=world\nfoo=bar");
}
use of com.nirima.jenkins.plugins.docker.DockerTemplate in project configuration-as-code-plugin by jenkinsci.
the class DockerCloudTest method configure_docker_cloud.
@Test
@ConfiguredWithCode("DockerCloudTest.yml")
public void configure_docker_cloud() throws Exception {
final DockerCloud docker = DockerCloud.getCloudByName("docker");
assertNotNull(docker);
assertNotNull(docker.getDockerApi());
assertNotNull(docker.getDockerApi().getDockerHost());
assertEquals("unix:///var/run/docker.sock", docker.getDockerApi().getDockerHost().getUri());
final DockerTemplate template = docker.getTemplate("jenkins/slave");
checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10");
}
use of com.nirima.jenkins.plugins.docker.DockerTemplate in project configuration-as-code-plugin by jenkinsci.
the class DockerCloudTest method update_docker_cloud.
@Test
@ConfiguredWithCode("DockerCloudTest/update_docker_cloud/DockerCloudTest1.yml")
public void update_docker_cloud() throws Exception {
DockerCloud docker = DockerCloud.getCloudByName("docker");
assertNotNull(docker);
assertNotNull(docker.getDockerApi());
assertNotNull(docker.getDockerApi().getDockerHost());
assertEquals("unix:///var/run/docker.sock", docker.getDockerApi().getDockerHost().getUri());
DockerTemplate template = docker.getTemplate(Label.get("docker-agent"));
checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10");
TestConfiguration.withCode("DockerCloudTest/update_docker_cloud/DockerCloudTest2.yml").configure(getClass());
docker = DockerCloud.getCloudByName("docker");
assertNotNull(docker);
assertNotNull(docker.getDockerApi());
assertNotNull(docker.getDockerApi().getDockerHost());
assertEquals("unix:///var/run/docker.sock", docker.getDockerApi().getDockerHost().getUri());
template = docker.getTemplate(Label.get("docker-agent"));
checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10");
template = docker.getTemplate(Label.get("generic"));
checkTemplate(template, "generic", "jenkins", "/home/jenkins/agent2", "5");
}
use of com.nirima.jenkins.plugins.docker.DockerTemplate in project configuration-as-code-plugin by jenkinsci.
the class DockerCloudTest method configure_docker_cloud.
@Test
@ConfiguredWithReadme("docker/README.md")
public void configure_docker_cloud() {
final DockerCloud docker = DockerCloud.getCloudByName("docker");
assertNotNull(docker);
assertNotNull(docker.getDockerApi());
assertNotNull(docker.getDockerApi().getDockerHost());
assertEquals("unix:///var/run/docker.sock", docker.getDockerApi().getDockerHost().getUri());
final DockerTemplate template = docker.getTemplate("jenkins/agent");
checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10", new String[] { "hello:/hello", "world:/world" }, "hello=world\nfoo=bar");
assertTrue(template.getRetentionStrategy() instanceof DockerOnceRetentionStrategy);
assertEquals(1, ((DockerOnceRetentionStrategy) template.getRetentionStrategy()).getIdleMinutes());
}
Aggregations