Search in sources :

Example 56 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class StageTestRunsTest method shouldReturnAllPipelineCounters.

@Test
public void shouldReturnAllPipelineCounters() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
    JobIdentifier jobIdentifier = new JobIdentifier(null, 1, null, null, null, "job1");
    stageTestRuns.add(18, "1.8", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(16, "1.6", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.removeDuplicateTestEntries();
    assertThat(stageTestRuns.failingCounters(), is(Arrays.asList(16, 17, 18)));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 57 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class StageTestRunsTest method removeDuplicateTestEntriesShouldRemoveFailuresThatHaveBeenFixedInSubsequentPipelines.

@Test
public void removeDuplicateTestEntriesShouldRemoveFailuresThatHaveBeenFixedInSubsequentPipelines() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
    JobIdentifier jobIdentifier = new JobIdentifier(null, 1, null, null, null, "job1");
    stageTestRuns.add(18, "1.8", "testSuite1", "testName0", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName0", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.removeDuplicateTestEntries();
    assertThat(stageTestRuns.failingTestsInPipelines().size(), is(2));
    FailingTestsInPipeline pipeline8 = stageTestRuns.failingTestsInPipelines().get(0);
    FailingTestsInPipeline pipeline7 = stageTestRuns.failingTestsInPipelines().get(1);
    assertThat(pipeline8.failingSuites().size(), is(0));
    assertThat(pipeline7.failingSuites().size(), is(1));
    assertThat(pipeline7.failingSuites().get(0).tests().size(), is(1));
    assertThat(pipeline7.failingSuites().get(0).tests().get(0).getName(), is("testName0"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 58 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class StageTestRunsTest method shouldReturnTheTotalNumberOfErrorsAndFailuresRollingUpFailuresInMultipleJobsToSingleFailure.

@Test
public void shouldReturnTheTotalNumberOfErrorsAndFailuresRollingUpFailuresInMultipleJobsToSingleFailure() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 3, 2);
    JobIdentifier jobIdentifier1 = new JobIdentifier(null, 1, null, null, null, "job1");
    JobIdentifier jobIdentifier2 = new JobIdentifier(null, 1, null, null, null, "job2");
    stageTestRuns.add(18, "lbl", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier2);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName2", TestStatus.Error, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName3", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName4", TestStatus.Error, jobIdentifier1);
    stageTestRuns.add(18, "lbl", "testSuite1", "testName5", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(17, "lbl", "testSuite1", "testName4", TestStatus.Error, jobIdentifier1);
    stageTestRuns.add(17, "lbl", "testSuite1", "testName5", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.add(16, "lbl", "testSuite1", "testName6", TestStatus.Failure, jobIdentifier1);
    stageTestRuns.removeDuplicateTestEntries();
    assertThat(stageTestRuns.count(TestStatus.Error), is(2));
    assertThat(stageTestRuns.count(TestStatus.Failure), is(3));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 59 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class TestInformationTest method equalsTrueWhenStatusSameNameSameAndJobIdentifiersHaveSameNames.

@Test
public void equalsTrueWhenStatusSameNameSameAndJobIdentifiersHaveSameNames() {
    TestInformation info1 = new TestInformation("test", TestStatus.Error);
    info1.addJob(new JobIdentifier(null, 1, null, null, null, "job1"));
    info1.addJob(new JobIdentifier(null, 2, null, null, null, "job"));
    TestInformation info2 = new TestInformation("test", TestStatus.Error);
    info2.addJob(new JobIdentifier(null, 3, null, null, null, "job1"));
    info2.addJob(new JobIdentifier(null, 4, null, null, null, "job"));
    assertThat(info1, is(info2));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 60 with JobIdentifier

use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.

the class TestInformationTest method testShouldSortJobIdentifiers.

@Test
public void testShouldSortJobIdentifiers() {
    TestInformation info = new TestInformation("test", TestStatus.Error);
    JobIdentifier first = new JobIdentifier(null, 1, null, null, null, "job1");
    JobIdentifier second = new JobIdentifier(null, 1, null, null, null, "job");
    info.addJob(first);
    info.addJob(second);
    assertThat(info.getJobs(), is(Arrays.asList(second, first)));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Aggregations

JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)113 Test (org.junit.Test)85 File (java.io.File)16 JobInstance (com.thoughtworks.go.domain.JobInstance)15 Pipeline (com.thoughtworks.go.domain.Pipeline)13 DateTime (org.joda.time.DateTime)12 Before (org.junit.Before)10 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)7 Stage (com.thoughtworks.go.domain.Stage)6 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)5 IllegalArtifactLocationException (com.thoughtworks.go.domain.exception.IllegalArtifactLocationException)5 AgentMetadata (com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata)5 IOException (java.io.IOException)5 ModelAndView (org.springframework.web.servlet.ModelAndView)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 Property (com.thoughtworks.go.domain.Property)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 RunIf (com.googlecode.junit.ext.RunIf)2 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)2 HeaderConstraint (com.thoughtworks.go.server.security.HeaderConstraint)2