Package com.groupon.jenkins.buildtype.util.shell

Examples of com.groupon.jenkins.buildtype.util.shell.ShellCommands


        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(of("image", "ubutu",
                "links",  asList(of("image","mysql",
                                     "name", "custom_mysql_name",
                                    "command","meow")),
                "command", "echo success"),"buildId", new ShellCommands());
        ShellCommands shellCommands = dockerImageBuildConfiguration.toShellCommands(null);
        Assert.assertEquals("docker run -d --name mysql_buildId mysql sh -cx \"meow\"",shellCommands.get(0));
        Assert.assertEquals("docker run --rm --sig-proxy=true --link mysql_buildId:custom_mysql_name ubutu sh -cx \"echo success\"",shellCommands.get(1));
        Assert.assertEquals("docker kill  mysql_buildId",shellCommands.get(2));
    }
View Full Code Here


    public void should_start_and_linked_containers_with_run_params_if_specified(){

        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(of("image", "ubutu",
                "links",  asList(of("image","mysql",
                                        "run_params","-v /var/test=/var/test"  )),
                "command", "echo success"),"buildId", new ShellCommands());
        ShellCommands shellCommands = dockerImageBuildConfiguration.toShellCommands(null);
        Assert.assertEquals("docker run -d --name mysql_buildId -v /var/test=/var/test mysql",shellCommands.get(0));
        Assert.assertEquals("docker run --rm --sig-proxy=true --link mysql_buildId:mysql ubutu sh -cx \"echo success\"",shellCommands.get(1));
        Assert.assertEquals("docker kill  mysql_buildId",shellCommands.get(2));
    }
View Full Code Here

    @Test
    public void should_run_container_with_specified_params() throws Exception {
        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(
                  of("image", "ubutu",
                     "run_params","-v /var/tmp=/var/tmp",
                     "command", "echo meow"),"buildId",new ShellCommands());
        ShellCommands shellCommands = dockerImageBuildConfiguration.toShellCommands(null);
        Assert.assertEquals("docker run --rm --sig-proxy=true -v /var/tmp=/var/tmp ubutu sh -cx \"echo meow\"",shellCommands.get(0));
    }
View Full Code Here


    @Test
    public void should_run_container_with_command() throws Exception {
        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(of("image", "ubutu",
                "command", Arrays.asList("echo step1", "echo step2")),"buildId",new ShellCommands());
        ShellCommands shellCommands = dockerImageBuildConfiguration.toShellCommands(null);
        Assert.assertEquals("docker run --rm --sig-proxy=true ubutu sh -cx \"echo step1 && echo step2\"",shellCommands.get(0));
    }
View Full Code Here


    @Test
    public void should_run_checkout_commands_before_commands() throws Exception {
        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(of("image", "ubutu",
                "command", Arrays.asList("echo step1", "echo step2")),"buildId",new ShellCommands("checkout command1"));
        ShellCommands shellCommands = dockerImageBuildConfiguration.toShellCommands(null);
        Assert.assertEquals("docker run --rm --sig-proxy=true ubutu sh -cx \"checkout command1 && echo step1 && echo step2\"",shellCommands.get(0));
    }
View Full Code Here

    @Test
    public void should_run_parallelized_if_command_is_parallized() throws Exception {
        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(of("image", "ubutu",
                "env", of("CI", "true"),
                "command", of("one","echo one", "two","echo two")),"buildId",new ShellCommands());
        Assert.assertTrue(dockerImageBuildConfiguration.isParallized());
    }
View Full Code Here

    }

    @Test
    public void should_run_parallel_build_of_the_combination_if_command_is_parallized() throws Exception {
        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(of("image", "ubutu",
                "command", of("one","echo one", "two","echo two")),"buildId",new ShellCommands());
        Assert.assertTrue(dockerImageBuildConfiguration.isParallized());
        ShellCommands shellCommands = dockerImageBuildConfiguration.toShellCommands(new Combination(of("command","two")));
        Assert.assertEquals("docker run --rm --sig-proxy=true ubutu sh -cx \"echo two\"",shellCommands.get(0));
    }
View Full Code Here

    @Test
    public void should_calculate_axis_list() throws Exception {
        DockerImageBuildConfiguration dockerImageBuildConfiguration = new DockerImageBuildConfiguration(of("image", "ubutu",
                "env", of("CI", "true"),
                "command", of("one","echo one", "two","echo two")),"buildId", new ShellCommands());
        Assert.assertNotNull(dockerImageBuildConfiguration.getAxisList());
    }
View Full Code Here

public class CheckoutCommandsTest {

    @Test
    public void should_checkout_pr_if_pr(){
       ShellCommands commands = CheckoutCommands.get(ImmutableMap.of("DOTCI_PULL_REQUEST", "17", "GIT_URL","git@github.com:groupon/DotCi.git")) ;
        Assert.assertEquals("git fetch origin \"+refs/pull/17/merge:\"",commands.get(2));
    }
View Full Code Here

        Assert.assertEquals("git fetch origin \"+refs/pull/17/merge:\"",commands.get(2));
    }

    @Test
    public void should_checkout_branch_if_branch(){
        ShellCommands commands = CheckoutCommands.get(ImmutableMap.of("GIT_URL", "git@github.com:groupon/DotCi.git", "DOTCI_BRANCH","dotci_branch")) ;
        Assert.assertEquals("git clone  --branch=dotci_branch https://github.com/groupon/DotCi /var/groupon/DotCi",commands.get(0));
    }
View Full Code Here

TOP

Related Classes of com.groupon.jenkins.buildtype.util.shell.ShellCommands

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.