Search in sources :

Example 1 with DockerOnceRetentionStrategy

use of com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy 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());
}
Also used : DockerTemplate(com.nirima.jenkins.plugins.docker.DockerTemplate) DockerCloud(com.nirima.jenkins.plugins.docker.DockerCloud) DockerOnceRetentionStrategy(com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Aggregations

DockerCloud (com.nirima.jenkins.plugins.docker.DockerCloud)1 DockerTemplate (com.nirima.jenkins.plugins.docker.DockerTemplate)1 DockerOnceRetentionStrategy (com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy)1 ConfiguredWithReadme (io.jenkins.plugins.casc.misc.ConfiguredWithReadme)1 Test (org.junit.Test)1