Search in sources :

Example 1 with MatrixBuild

use of hudson.matrix.MatrixBuild in project blueocean-plugin by jenkinsci.

the class PipelineApiTest method matrixProjectTest.

@Test
public void matrixProjectTest() throws Exception {
    MatrixProject mp = j.jenkins.createProject(MatrixProject.class, "mp1");
    mp.getAxes().add(new Axis("os", "linux", "windows"));
    mp.getAxes().add(new Axis("jdk", "1.7", "1.8"));
    MatrixBuild matrixBuild = mp.scheduleBuild2(0).get();
    j.assertBuildStatusSuccess(matrixBuild);
    List<Map> pipelines = get("/search/?q=type:pipeline;excludedFromFlattening:jenkins.branch.MultiBranchProject,hudson.matrix.MatrixProject", List.class);
    Assert.assertEquals(1, pipelines.size());
    Map p = pipelines.get(0);
    Assert.assertEquals("mp1", p.get("name"));
    String href = getHrefFromLinks(p, "self");
    Assert.assertEquals("/job/mp1/", href);
}
Also used : MatrixProject(hudson.matrix.MatrixProject) Map(java.util.Map) Axis(hudson.matrix.Axis) MatrixBuild(hudson.matrix.MatrixBuild) Test(org.junit.Test)

Example 2 with MatrixBuild

use of hudson.matrix.MatrixBuild in project hudson-2.x by hudson.

the class HudsonTestCase method assertBuildStatus.

/**
     * Asserts that the outcome of the build is a specific outcome.
     */
public <R extends Run> R assertBuildStatus(Result status, R r) throws Exception {
    if (status == r.getResult())
        return r;
    // dump the build output in failure message
    String msg = "unexpected build status; build log was:\n------\n" + getLog(r) + "\n------\n";
    if (r instanceof MatrixBuild) {
        MatrixBuild mb = (MatrixBuild) r;
        for (MatrixRun mr : mb.getRuns()) {
            msg += "--- " + mr.getParent().getCombination() + " ---\n" + getLog(mr) + "\n------\n";
        }
    }
    assertEquals(msg, status, r.getResult());
    return r;
}
Also used : MatrixRun(hudson.matrix.MatrixRun) MatrixBuild(hudson.matrix.MatrixBuild)

Aggregations

MatrixBuild (hudson.matrix.MatrixBuild)2 Axis (hudson.matrix.Axis)1 MatrixProject (hudson.matrix.MatrixProject)1 MatrixRun (hudson.matrix.MatrixRun)1 Map (java.util.Map)1 Test (org.junit.Test)1